You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by ch...@apache.org on 2006/06/27 08:00:29 UTC

svn commit: r417349 - in /lenya/trunk/src: modules-core/usecase-impl/java/src/org/apache/lenya/cms/ac/usecase/UsecaseAuthorizerImpl.java webapp/global-sitemap.xmap

Author: chestnut
Date: Mon Jun 26 23:00:29 2006
New Revision: 417349

URL: http://svn.apache.org/viewvc?rev=417349&view=rev
Log:
read usecase-policies.xml uri from ac.xconf

Modified:
    lenya/trunk/src/modules-core/usecase-impl/java/src/org/apache/lenya/cms/ac/usecase/UsecaseAuthorizerImpl.java
    lenya/trunk/src/webapp/global-sitemap.xmap

Modified: lenya/trunk/src/modules-core/usecase-impl/java/src/org/apache/lenya/cms/ac/usecase/UsecaseAuthorizerImpl.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/usecase-impl/java/src/org/apache/lenya/cms/ac/usecase/UsecaseAuthorizerImpl.java?rev=417349&r1=417348&r2=417349&view=diff
==============================================================================
--- lenya/trunk/src/modules-core/usecase-impl/java/src/org/apache/lenya/cms/ac/usecase/UsecaseAuthorizerImpl.java (original)
+++ lenya/trunk/src/modules-core/usecase-impl/java/src/org/apache/lenya/cms/ac/usecase/UsecaseAuthorizerImpl.java Mon Jun 26 23:00:29 2006
@@ -200,7 +200,7 @@
         }
     }
 
-    protected static final String CONFIGURATION_FILE = "/config/ac/usecase-policies.xml";
+    protected static String CONFIGURATION_FILE = null;
     protected static final String PARAMETER_CONFIGURATION = "configuration";
 
     /**
@@ -242,6 +242,9 @@
     }
 
     protected static final String AC_CONFIGURATION_FILE = "config/ac/ac.xconf".replace('/', File.separatorChar);
+    protected static final String AUTHORIZER_ELEMENT = "authorizer"; 
+    protected static final String TYPE_ATTRIBUTE = "type";
+    protected static final String USECASE_TYPE = "usecase";
     
     /**
      * Retrieves access control configuration of a specific publication.
@@ -255,6 +258,12 @@
         if (configurationFile.isFile()) {
             try {
                 Configuration configuration = new DefaultConfigurationBuilder().buildFromFile(configurationFile);
+                Configuration[] authorizers = configuration.getChildren(AUTHORIZER_ELEMENT);
+                for (int i = 0; i < authorizers.length; i++) {
+                    if (authorizers[i].getAttribute(TYPE_ATTRIBUTE) == USECASE_TYPE) {
+                        this.CONFIGURATION_FILE = authorizers[i].getValue();
+                    }
+                }
                 return configuration;
             } catch (Exception e) {
                 throw new AccessControlException(e);

Modified: lenya/trunk/src/webapp/global-sitemap.xmap
URL: http://svn.apache.org/viewvc/lenya/trunk/src/webapp/global-sitemap.xmap?rev=417349&r1=417348&r2=417349&view=diff
==============================================================================
--- lenya/trunk/src/webapp/global-sitemap.xmap (original)
+++ lenya/trunk/src/webapp/global-sitemap.xmap Mon Jun 26 23:00:29 2006
@@ -151,10 +151,7 @@
         <map:call resource="i18n"/>
         
         <!-- Disable menu items according to usecase policies -->
-        <!-- TODO: Use the configuration of config/ac/ac.xconf resp. org.apache.lenya.cms.ac.usecase.UsecaseAuthorizer -->
-        <map:act type="resource-exists" src="lenya/pubs/{1}/config/ac/usecase-policies.xml">
-          <map:transform type="usecasemenu"/>
-        </map:act>
+        <map:transform type="usecasemenu"/>
 
         <map:select type="request-parameter">
           <map:parameter name="parameter-name" value="uiml"/>



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org