svn commit: r674437 - in /lenya/branches/branch_1_2_x_shibboleth/src/webapp/lenya/content/admin: common/access-control.js groups/group-admin.js groups/overview.xsp groups/profile.xsp

[email protected]
Newsgroups gmane.comp.cms.lenya.cvs
Message-ID <[email protected]>
Author: andreas
Date: Mon Jul  7 03:00:18 2008
New Revision: 674437

URL: http://svn.apache.org/viewvc?rev=674437&view=rev
Log:
Changing administration usecases to match attribute handling changes.

Modified:
    lenya/branches/branch_1_2_x_shibboleth/src/webapp/lenya/content/admin/common/access-control.js
    lenya/branches/branch_1_2_x_shibboleth/src/webapp/lenya/content/admin/groups/group-admin.js
    lenya/branches/branch_1_2_x_shibboleth/src/webapp/lenya/content/admin/groups/overview.xsp
    lenya/branches/branch_1_2_x_shibboleth/src/webapp/lenya/content/admin/groups/profile.xsp

Modified: lenya/branches/branch_1_2_x_shibboleth/src/webapp/lenya/content/admin/common/access-control.js
URL: http://svn.apache.org/viewvc/lenya/branches/branch_1_2_x_shibboleth/src/webapp/lenya/content/admin/common/access-control.js?rev=674437&r1=674436&r2=674437&view=diff
==============================================================================
--- lenya/branches/branch_1_2_x_shibboleth/src/webapp/lenya/content/admin/common/access-control.js (original)
+++ lenya/branches/branch_1_2_x_shibboleth/src/webapp/lenya/content/admin/common/access-control.js Mon Jul  7 03:00:18 2008
@@ -37,16 +37,20 @@
 var accreditableManager;
 var selector;
 var resolver;
+var attributeSet;
+var evaluator;
 
 function resolve() {
 
-    selector = cocoon.getComponent(Packages.org.apache.lenya.ac.AccessControllerResolver.ROLE + "Selector");
+  selector = cocoon.getComponent(Packages.org.apache.lenya.ac.AccessControllerResolver.ROLE + "Selector");
 	resolver = selector.select(Packages.org.apache.lenya.ac.AccessControllerResolver.DEFAULT_RESOLVER);
 	var requestUrl = cocoon.parameters["requestUri"];
 	var contextPath = cocoon.parameters["contextPath"];
 	var webappUrl = Packages.org.apache.lenya.util.ServletHelper.getWebappURI(contextPath, requestUrl);
 	var accessController = resolver.resolveAccessController(webappUrl);
+	attributeSet = accessController.getAuthenticator().getAttributeSet();
 	accreditableManager = accessController.getAccreditableManager();
+	evaluator = accreditableManager.getAttributeManager().getEvaluator();
 }
 
 function release() {

Modified: lenya/branches/branch_1_2_x_shibboleth/src/webapp/lenya/content/admin/groups/group-admin.js
URL: http://svn.apache.org/viewvc/lenya/branches/branch_1_2_x_shibboleth/src/webapp/lenya/content/admin/groups/group-admin.js?rev=674437&r1=674436&r2=674437&view=diff
==============================================================================
--- lenya/branches/branch_1_2_x_shibboleth/src/webapp/lenya/content/admin/groups/group-admin.js (original)
+++ lenya/branches/branch_1_2_x_shibboleth/src/webapp/lenya/content/admin/groups/group-admin.js Mon Jul  7 03:00:18 2008
@@ -30,15 +30,13 @@
         var group = groupManager.getGroup(groupId);
         var name = group.getName();
         var description = group.getDescription();
-        var rule = group.getRule();
+        var ruleObject = group.getRule();
+        var rule = ruleObject != null ? ruleObject.getRule() : "";
         
         var valid = false;
         
         var messages = new java.util.ArrayList();
         
-        var translator = cocoon.getComponent("org.apache.lenya.ac.saml.AttributeTranslator");
-        var attributeNames = translator.getSupportedResultNames();
-        
         while (!valid) {
             cocoon.sendPageAndWait("groups/profile.xml", {
                 "group-id" : groupId,
@@ -46,7 +44,7 @@
                 "description" : description,
                 "rule" : rule,
                 "page-title" : "Edit Profile",
-                "attribute-names" : attributeNames,
+                "attributes" : attributeSet,
                 "messages" : messages
             });
 
@@ -63,8 +61,7 @@
                     rule = null;
                 }
                 if (rule != null) {
-                    var evaluator = groupManager.getAttributeRuleEvaluator();
-                    var result = evaluator.validate(rule);
+                    var result = evaluator.validate(rule, attributeSet);
                     valid = result.succeeded();
                     if (!valid) {
                         var validationMessages = result.getMessages();
@@ -74,7 +71,8 @@
                     }
                 }
                 if (valid) {
-                    group.setRule(rule);
+                    var ruleObj = new Packages.org.apache.lenya.ac.attr.impl.AttributeRuleImpl(rule, attributeSet, evaluator);
+                    group.setRule(ruleObj);
                     name = cocoon.request.getParameter("name");
                     description = cocoon.request.getParameter("description");
                     group.setName(name);

Modified: lenya/branches/branch_1_2_x_shibboleth/src/webapp/lenya/content/admin/groups/overview.xsp
URL: http://svn.apache.org/viewvc/lenya/branches/branch_1_2_x_shibboleth/src/webapp/lenya/content/admin/groups/overview.xsp?rev=674437&r1=674436&r2=674437&view=diff
==============================================================================
--- lenya/branches/branch_1_2_x_shibboleth/src/webapp/lenya/content/admin/groups/overview.xsp (original)
+++ lenya/branches/branch_1_2_x_shibboleth/src/webapp/lenya/content/admin/groups/overview.xsp Mon Jul  7 03:00:18 2008
@@ -34,6 +34,7 @@
     <xsp:include>org.apache.lenya.ac.Item</xsp:include>
     <xsp:include>org.apache.lenya.ac.Machine</xsp:include>
     <xsp:include>org.apache.lenya.ac.User</xsp:include>
+    <xsp:include>org.apache.lenya.ac.attr.AttributeRule</xsp:include>
     <xsp:include>java.io.File</xsp:include>
     <xsp:include>java.util.*</xsp:include>
   </xsp:structure>
@@ -68,13 +69,17 @@
             }
         }
         
-        
+        AttributeRule rule = group.getRule();
+        String ruleString = null;
+        if (rule != null) {
+            ruleString = rule.getRule();
+        }
     </xsp:logic>
     <group>
       <id><xsp:expr>group.getId()</xsp:expr></id>
       <name><xsp:expr>group.getName()</xsp:expr></name>
       <description><xsp:expr>group.getDescription()</xsp:expr></description>
-      <rule><xsp:expr>group.getRule()</xsp:expr></rule>
+      <rule><xsp:expr>ruleString</xsp:expr></rule>
       <users>
         <xsp:logic>
             for (Iterator i = users.iterator(); i.hasNext();) {

Modified: lenya/branches/branch_1_2_x_shibboleth/src/webapp/lenya/content/admin/groups/profile.xsp
URL: http://svn.apache.org/viewvc/lenya/branches/branch_1_2_x_shibboleth/src/webapp/lenya/content/admin/groups/profile.xsp?rev=674437&r1=674436&r2=674437&view=diff
==============================================================================
--- lenya/branches/branch_1_2_x_shibboleth/src/webapp/lenya/content/admin/groups/profile.xsp (original)
+++ lenya/branches/branch_1_2_x_shibboleth/src/webapp/lenya/content/admin/groups/profile.xsp Mon Jul  7 03:00:18 2008
@@ -27,6 +27,8 @@
   
   <xsp:structure>
     <xsp:include>org.apache.lenya.ac.Message</xsp:include>
+    <xsp:include>org.apache.lenya.ac.attr.Attribute</xsp:include>
+    <xsp:include>org.apache.lenya.ac.attr.AttributeSet</xsp:include>
   </xsp:structure>
   
   <page>
@@ -61,9 +63,11 @@
     </group>
     <attributeNames>
       <xsp:logic>
-        String[] names = (String[]) <jpath:value-of select="attribute-names"/>;
+        AttributeSet attrSet = (AttributeSet) <jpath:value-of select="attributes"/>;
+        String[] names = (String[]) attrSet.getAttributeNames(); 
         for (int i = 0; i &lt; names.length; i++) {
-            <attributeName><xsp:expr>names[i]</xsp:expr></attributeName>
+            Attribute attr = attrSet.getAttribute(names[i]);
+            <attributeName><xsp:expr>attr.getAlias()</xsp:expr></attributeName>
         }
       </xsp:logic>
     </attributeNames>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.