You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2006/11/10 19:51:31 UTC

svn commit: r473418 - in /lenya/trunk/src: java/org/apache/lenya/ac/ modules-core/ac-impl/java/src/org/apache/lenya/ac/file/ modules-core/ac-impl/java/src/org/apache/lenya/cms/ac/ modules-core/ac-impl/java/test/org/apache/lenya/ac/impl/ modules-core/ad...

Author: andreas
Date: Fri Nov 10 10:51:30 2006
New Revision: 473418

URL: http://svn.apache.org/viewvc?view=rev&rev=473418
Log:
Removed support for URL credentials (not necessary anymore with new policy handling)

Modified:
    lenya/trunk/src/java/org/apache/lenya/ac/InheritingPolicyManager.java
    lenya/trunk/src/modules-core/ac-impl/java/src/org/apache/lenya/ac/file/FilePolicyManager.java
    lenya/trunk/src/modules-core/ac-impl/java/src/org/apache/lenya/cms/ac/DocumentPolicyManagerWrapper.java
    lenya/trunk/src/modules-core/ac-impl/java/test/org/apache/lenya/ac/impl/PolicyTest.java
    lenya/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/AccessControl.java
    lenya/trunk/src/modules-core/sitemanagement/usecases/tab/ac/ac.jx

Modified: lenya/trunk/src/java/org/apache/lenya/ac/InheritingPolicyManager.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/ac/InheritingPolicyManager.java?view=diff&rev=473418&r1=473417&r2=473418
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/ac/InheritingPolicyManager.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/ac/InheritingPolicyManager.java Fri Nov 10 10:51:30 2006
@@ -28,16 +28,6 @@
 public interface InheritingPolicyManager extends PolicyManager {
 
     /**
-     * Builds the URL policy for a URL from a file. When the file is not present, an empty policy is
-     * returned.
-     * @param controller The access controller to use.
-     * @param url The URL inside the web application.
-     * @return A policy.
-     * @throws AccessControlException when something went wrong.
-     */
-    Policy buildURLPolicy(AccreditableManager controller, String url) throws AccessControlException;
-
-    /**
      * Builds a subtree policy from a file. When the file is not present, an empty policy is
      * returned.
      * @param controller The access controller to use.
@@ -56,14 +46,6 @@
      * @throws AccessControlException when something went wrong.
      */
     Policy[] getPolicies(AccreditableManager controller, String url) throws AccessControlException;
-
-    /**
-     * Saves a URL policy.
-     * @param url The URL to save the policy for.
-     * @param policy The policy to save.
-     * @throws AccessControlException when something went wrong.
-     */
-    void saveURLPolicy(String url, Policy policy) throws AccessControlException;
 
     /**
      * Saves a Subtree policy.

Modified: lenya/trunk/src/modules-core/ac-impl/java/src/org/apache/lenya/ac/file/FilePolicyManager.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/ac-impl/java/src/org/apache/lenya/ac/file/FilePolicyManager.java?view=diff&rev=473418&r1=473417&r2=473418
==============================================================================
--- lenya/trunk/src/modules-core/ac-impl/java/src/org/apache/lenya/ac/file/FilePolicyManager.java (original)
+++ lenya/trunk/src/modules-core/ac-impl/java/src/org/apache/lenya/ac/file/FilePolicyManager.java Fri Nov 10 10:51:30 2006
@@ -69,13 +69,11 @@
         Parameterizable, Disposable, Serviceable {
 
     private static final class SubtreeFileFilter implements FileFilter {
-        private final String url;
 
         private final String subtree;
 
-        private SubtreeFileFilter(String _url, String _subtree) {
+        private SubtreeFileFilter(String _subtree) {
             super();
-            this.url = _url;
             this.subtree = _subtree;
         }
 
@@ -83,7 +81,7 @@
          * @see java.io.FileFilter#accept(java.io.File)
          */
         public boolean accept(File file) {
-            return file.getName().equals(this.subtree) || file.getName().equals(this.url);
+            return file.getName().equals(this.subtree);
         }
     }
 
@@ -114,24 +112,9 @@
 
     private SourceCache cache;
 
-    protected static final String URL_FILENAME = "url-policy.acml";
     protected static final String SUBTREE_FILENAME = "subtree-policy.acml";
 
     /**
-     * Builds the URL policy for a URL from a file. When the file is not
-     * present, an empty policy is returned.
-     * 
-     * @param controller The access controller to use.
-     * @param url The URL inside the web application.
-     * @return A policy.
-     * @throws AccessControlException when something went wrong.
-     */
-    public Policy buildURLPolicy(AccreditableManager controller, String url)
-            throws AccessControlException {
-        return buildPolicy(controller, url, URL_FILENAME);
-    }
-
-    /**
      * Builds a subtree policy from a file. When the file is not present, an
      * empty policy is returned.
      * 
@@ -236,18 +219,6 @@
     }
 
     /**
-     * Saves a URL policy.
-     * 
-     * @param url The URL to save the policy for.
-     * @param policy The policy to save.
-     * @throws AccessControlException when something went wrong.
-     */
-    public void saveURLPolicy(String url, Policy policy) throws AccessControlException {
-        getLogger().debug("Saving URL policy for URL [" + url + "]");
-        savePolicy(url, policy, URL_FILENAME);
-    }
-
-    /**
      * Saves a Subtree policy.
      * 
      * @param url The url to save the policy for.
@@ -400,7 +371,6 @@
         
         url = url.substring(1);
 
-        String orgUrl = url;
         List policies = new LinkedList();
         HashMap orderedPolicies = new LinkedHashMap();
         int position = 1;
@@ -414,8 +384,6 @@
             orderedPolicies.put(String.valueOf(position), policy);
             position++;
         }
-        policy = buildURLPolicy(controller, orgUrl);
-        orderedPolicies.put(String.valueOf(position), policy);
         for (int i = orderedPolicies.size(); i > 0; i--) {
             policies.add(orderedPolicies.get(String.valueOf(i)));
         }
@@ -448,8 +416,7 @@
     protected void removeAccreditable(AccreditableManager manager, Accreditable accreditable,
             File policyDirectory) throws AccessControlException {
 
-        File[] policyFiles = policyDirectory.listFiles(new SubtreeFileFilter(URL_FILENAME,
-                SUBTREE_FILENAME));
+        File[] policyFiles = policyDirectory.listFiles(new SubtreeFileFilter(SUBTREE_FILENAME));
 
         try {
             RemovedAccreditablePolicyBuilder builder = new RemovedAccreditablePolicyBuilder(manager);
@@ -524,31 +491,18 @@
 
         HashMap orderedCredential = new LinkedHashMap();
         int position = 1;
-        Policy policy;
-        String orgUrl = url;
 
         String[] directories = url.split("/");
         url = directories[0] + "/";
 
         for (int i = 1; i < directories.length; i++) {
             url += directories[i] + "/";
-            policy = buildSubtreePolicy(controller, url);
+            Policy policy = buildSubtreePolicy(controller, url);
             Credential[] tmp = policy.getCredentials();
             // we need to revert the order of the credentials
             // to keep the most important policy on top
             for (int j = tmp.length - 1; j >= 0; j--) {
                 Credential credential = tmp[j];
-                orderedCredential.put(String.valueOf(position), credential);
-                position++;
-            }
-        }
-        policy = buildURLPolicy(controller, orgUrl);
-        if (policy != null) {
-            Credential[] tmp = policy.getCredentials();
-            // we need to revert the order of the credentials
-            // to keep the most important policy on top
-            for (int i = tmp.length - 1; i >= 0; i--) {
-                Credential credential = tmp[i];
                 orderedCredential.put(String.valueOf(position), credential);
                 position++;
             }

Modified: lenya/trunk/src/modules-core/ac-impl/java/src/org/apache/lenya/cms/ac/DocumentPolicyManagerWrapper.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/ac-impl/java/src/org/apache/lenya/cms/ac/DocumentPolicyManagerWrapper.java?view=diff&rev=473418&r1=473417&r2=473418
==============================================================================
--- lenya/trunk/src/modules-core/ac-impl/java/src/org/apache/lenya/cms/ac/DocumentPolicyManagerWrapper.java (original)
+++ lenya/trunk/src/modules-core/ac-impl/java/src/org/apache/lenya/cms/ac/DocumentPolicyManagerWrapper.java Fri Nov 10 10:51:30 2006
@@ -173,11 +173,6 @@
         this.policyManager = _policyManager;
     }
 
-    public Policy buildURLPolicy(AccreditableManager controller, String url)
-            throws AccessControlException {
-        return getPolicyManager().buildURLPolicy(controller, getPolicyURL(url));
-    }
-
     public Policy buildSubtreePolicy(AccreditableManager controller, String url)
             throws AccessControlException {
         return getPolicyManager().buildSubtreePolicy(controller, getPolicyURL(url));
@@ -186,11 +181,6 @@
     public Policy[] getPolicies(AccreditableManager controller, String url)
             throws AccessControlException {
         return getPolicyManager().getPolicies(controller, getPolicyURL(url));
-    }
-
-    public void saveURLPolicy(String url, Policy policy) throws AccessControlException {
-        getPolicyManager().saveURLPolicy(getPolicyURL(url), policy);
-
     }
 
     public void saveSubtreePolicy(String url, Policy policy) throws AccessControlException {

Modified: lenya/trunk/src/modules-core/ac-impl/java/test/org/apache/lenya/ac/impl/PolicyTest.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/ac-impl/java/test/org/apache/lenya/ac/impl/PolicyTest.java?view=diff&rev=473418&r1=473417&r2=473418
==============================================================================
--- lenya/trunk/src/modules-core/ac-impl/java/test/org/apache/lenya/ac/impl/PolicyTest.java (original)
+++ lenya/trunk/src/modules-core/ac-impl/java/test/org/apache/lenya/ac/impl/PolicyTest.java Fri Nov 10 10:51:30 2006
@@ -82,11 +82,11 @@
      */
     public void testSavePolicy() throws AccessControlException {
         InheritingPolicyManager policyManager = (InheritingPolicyManager) getPolicyManager();
-        DefaultPolicy urlPolicy = (DefaultPolicy) policyManager.buildURLPolicy(
+        DefaultPolicy subtreePolicy = (DefaultPolicy) policyManager.buildSubtreePolicy(
                 getAccessController().getAccreditableManager(), URL);
         DefaultPolicy newPolicy = new DefaultPolicy();
 
-        Credential[] credentials = urlPolicy.getCredentials();
+        Credential[] credentials = subtreePolicy.getCredentials();
 
         for (int i = 0; i < credentials.length; i++) {
             Role role = credentials[i].getRole();
@@ -95,13 +95,13 @@
             newPolicy.addCredential(credential);
         }
 
-        assertEquals(urlPolicy.getCredentials().length, newPolicy.getCredentials().length);
+        assertEquals(subtreePolicy.getCredentials().length, newPolicy.getCredentials().length);
 
-        policyManager.saveURLPolicy(SAVE_URL, newPolicy);
+        policyManager.saveSubtreePolicy(SAVE_URL, newPolicy);
 
-        newPolicy = (DefaultPolicy) policyManager.buildURLPolicy(getAccessController()
+        newPolicy = (DefaultPolicy) policyManager.buildSubtreePolicy(getAccessController()
                 .getAccreditableManager(), SAVE_URL);
-        assertEquals(urlPolicy.getCredentials().length, newPolicy.getCredentials().length);
+        assertEquals(subtreePolicy.getCredentials().length, newPolicy.getCredentials().length);
 
         Credential[] newCredentials = newPolicy.getCredentials();
 

Modified: lenya/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/AccessControl.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/AccessControl.java?view=diff&rev=473418&r1=473417&r2=473418
==============================================================================
--- lenya/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/AccessControl.java (original)
+++ lenya/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/AccessControl.java Fri Nov 10 10:51:30 2006
@@ -62,8 +62,7 @@
 
     protected static final String SUB_IPRANGE = "subipRange";
 
-    private static String[] types = { USER, GROUP, IPRANGE, SUB_USER,
-            SUB_GROUP, SUB_IPRANGE };
+    private static String[] types = { USER, GROUP, IPRANGE, SUB_USER, SUB_GROUP, SUB_IPRANGE };
 
     private static String[] operations = { ADD, DELETE, DOWN, UP };
 
@@ -73,8 +72,6 @@
 
     protected static final String DOCUMENT = "document";
 
-    protected static final String URL_CREDENTIALS = "urlCredentials";
-
     protected static final String SUB_CREDENTIALS = "subCredentials";
 
     protected static final String PARENT_CREDENTIALS = "parentCredentials";
@@ -105,8 +102,7 @@
             setParameter(DOCUMENT, sourceDocument);
 
             setParameter(SSL, Boolean.toString(isSSLProtected()));
-            setParameter(ANCESTOR_SSL, Boolean
-                    .toString(isAncestorSSLProtected()));
+            setParameter(ANCESTOR_SSL, Boolean.toString(isAncestorSSLProtected()));
 
             User[] users = getUserManager().getUsers();
             String[] userIds = new String[users.length];
@@ -145,14 +141,12 @@
             setParameter("roles", roleIds);
             setParameter("visitorRole", visitorRole);
 
-            setParameter(URL_CREDENTIALS, getURICredentials());
             setParameter(SUB_CREDENTIALS, getSubtreeCredentials());
             setParameter(PARENT_CREDENTIALS, getParentCredentials());
 
         } catch (final Exception e) {
             addErrorMessage("Could not read a value.");
-            getLogger().error(
-                    "Could not read value for AccessControl usecase. ", e);
+            getLogger().error("Could not read value for AccessControl usecase. ", e);
         }
 
     }
@@ -164,8 +158,7 @@
         super.doCheckPreconditions();
         URLInformation info = new URLInformation(getSourceURL());
         String acArea = getParameterAsString(AC_AREA);
-        if (!acArea.equals(Publication.LIVE_AREA)
-                && !info.getArea().equals(acArea)) {
+        if (!acArea.equals(Publication.LIVE_AREA) && !info.getArea().equals(acArea)) {
             addErrorMessage("This usecase can only be invoked in the configured area.");
         }
     }
@@ -173,8 +166,7 @@
     /**
      * Validates the request parameters.
      * 
-     * @throws UsecaseException
-     *             if an error occurs.
+     * @throws UsecaseException if an error occurs.
      */
     void validate() throws UsecaseException {
         // do nothing
@@ -215,11 +207,7 @@
                     String type = types[i];
                     String paramName = operations[j] + "Credential_" + type;
                     if (getParameterAsString(paramName) != null) {
-                        boolean inherit = false;
-                        if (type.startsWith("sub")) {
-                            type = type.substring("sub".length());
-                            inherit = true;
-                        }
+                        boolean inherit = true;
                         String roleId = getParameterAsString(ROLE);
                         String method = getParameterAsString(METHOD);
 
@@ -233,22 +221,14 @@
                             item = getIpRangeManager().getIPRange(id);
                         }
                         if (item == null) {
-                            addErrorMessage("no_such_accreditable",
-                                    new String[] { type, id });
+                            addErrorMessage("no_such_accreditable", new String[] { type, id });
                         } else {
                             Role role = getRoleManager().getRole(roleId);
                             if (role == null) {
-                                addErrorMessage("role_no_such_role",
-                                        new String[] { roleId });
+                                addErrorMessage("role_no_such_role", new String[] { roleId });
                             }
-                            manipulateCredential(item, role, operations[j],
-                                    method, inherit);
-                            if (inherit)
-                                setParameter(SUB_CREDENTIALS,
-                                        getSubtreeCredentials());
-                            else
-                                setParameter(URL_CREDENTIALS,
-                                        getURICredentials());
+                            manipulateCredential(item, role, operations[j], method);
+                            setParameter(SUB_CREDENTIALS, getSubtreeCredentials());
                         }
                         deleteParameter(paramName);
                     }
@@ -279,8 +259,7 @@
      * Returns if one of the ancestors of this URL is SSL protected.
      * 
      * @return A boolean value.
-     * @throws ProcessingException
-     *             when something went wrong.
+     * @throws ProcessingException when something went wrong.
      */
     protected boolean isAncestorSSLProtected() throws ProcessingException {
         boolean ssl;
@@ -291,8 +270,7 @@
                 ancestorUrl = getPolicyURL().substring(0, lastSlashIndex);
             }
 
-            Policy policy = getPolicyManager().getPolicy(
-                    getAccreditableManager(), ancestorUrl);
+            Policy policy = getPolicyManager().getPolicy(getAccreditableManager(), ancestorUrl);
             ssl = policy.isSSLProtected();
         } catch (AccessControlException e) {
             throw new ProcessingException("Resolving policy failed: ", e);
@@ -304,14 +282,12 @@
      * Returns if one of the ancestors of this URL is SSL protected.
      * 
      * @return A boolean value.
-     * @throws ProcessingException
-     *             when something went wrong.
+     * @throws ProcessingException when something went wrong.
      */
     protected boolean isSSLProtected() throws ProcessingException {
         boolean ssl;
         try {
-            Policy policy = getPolicyManager().getPolicy(
-                    getAccreditableManager(), getPolicyURL());
+            Policy policy = getPolicyManager().getPolicy(getAccreditableManager(), getPolicyURL());
             ssl = policy.isSSLProtected();
         } catch (AccessControlException e) {
             throw new ProcessingException("Resolving policy failed: ", e);
@@ -322,16 +298,13 @@
     /**
      * Sets if this URL is SSL protected.
      * 
-     * @param ssl
-     *            A boolean value.
-     * @throws ProcessingException
-     *             when something went wrong.
+     * @param ssl A boolean value.
+     * @throws ProcessingException when something went wrong.
      */
     protected void setSSLProtected(boolean ssl) throws ProcessingException {
         try {
-            ModifiablePolicy policy = (ModifiablePolicy) getPolicyManager()
-                    .buildSubtreePolicy(getAccreditableManager(),
-                            getPolicyURL());
+            ModifiablePolicy policy = (ModifiablePolicy) getPolicyManager().buildSubtreePolicy(
+                    getAccreditableManager(), getPolicyURL());
             policy.setSSL(ssl);
             getPolicyManager().saveSubtreePolicy(getPolicyURL(), policy);
         } catch (AccessControlException e) {
@@ -340,8 +313,7 @@
     }
 
     protected InheritingPolicyManager getPolicyManager() {
-        return (InheritingPolicyManager) getAccessController()
-                .getPolicyManager();
+        return (InheritingPolicyManager) getAccessController().getPolicyManager();
     }
 
     protected AccreditableManager getAccreditableManager() {
@@ -351,28 +323,19 @@
     /**
      * Changes a credential by adding or deleting an item for a role.
      * 
-     * @param item
-     *            The item to add or delete.
-     * @param role
-     *            The role.
-     * @param operation
-     *            The operation, either {@link #ADD}or {@link #DELETE}.
+     * @param item The item to add or delete.
+     * @param role The role.
+     * @param operation The operation, either {@link #ADD}or {@link #DELETE}.
      * @param inherit
      * @param method2
-     * @throws ProcessingException
-     *             when something went wrong.
+     * @throws ProcessingException when something went wrong.
      */
-    protected void manipulateCredential(Item item, Role role, String operation,
-            String method, boolean inherit) throws ProcessingException {
+    protected void manipulateCredential(Item item, Role role, String operation, String method)
+            throws ProcessingException {
         ModifiablePolicy policy = null;
         try {
-            if (inherit)
-                policy = (ModifiablePolicy) getPolicyManager()
-                        .buildSubtreePolicy(getAccreditableManager(),
-                                getPolicyURL());
-            else
-                policy = (ModifiablePolicy) getPolicyManager().buildURLPolicy(
-                        getAccreditableManager(), getPolicyURL());
+            policy = (ModifiablePolicy) getPolicyManager().buildSubtreePolicy(
+                    getAccreditableManager(), getPolicyURL());
             Accreditable accreditable = (Accreditable) item;
 
             if (operation.equals(ADD)) {
@@ -384,10 +347,7 @@
             } else if (operation.equals(DOWN)) {
                 policy.moveRoleDown(accreditable, role);
             }
-            if (inherit)
-                getPolicyManager().saveSubtreePolicy(getPolicyURL(), policy);
-            else
-                getPolicyManager().saveURLPolicy(getPolicyURL(), policy);
+            getPolicyManager().saveSubtreePolicy(getPolicyURL(), policy);
 
         } catch (Exception e) {
             throw new ProcessingException("Manipulating credential failed: ", e);
@@ -395,26 +355,13 @@
     }
 
     /**
-     * Returns the URI credential wrappers for the request of this object model.
+     * Returns the credential wrappers for the request of this object model.
      * 
      * @return An array of CredentialWrappers.
-     * @throws ProcessingException
-     *             when something went wrong.
+     * @throws ProcessingException when something went wrong.
      */
-    public CredentialWrapper[] getURICredentials() throws ProcessingException {
-        return getCredentials(true, false);
-    }
-
-    /**
-     * Returns the URI credential wrappers for the request of this object model.
-     * 
-     * @return An array of CredentialWrappers.
-     * @throws ProcessingException
-     *             when something went wrong.
-     */
-    public CredentialWrapper[] getSubtreeCredentials()
-            throws ProcessingException {
-        return getCredentials(false, true);
+    public CredentialWrapper[] getSubtreeCredentials() throws ProcessingException {
+        return getCredentials(true);
     }
 
     /**
@@ -422,30 +369,23 @@
      * to the request of this object model.
      * 
      * @return An array of CredentialWrappers.
-     * @throws ProcessingException
-     *             when something went wrong.
+     * @throws ProcessingException when something went wrong.
      */
-    public CredentialWrapper[] getParentCredentials()
-            throws ProcessingException {
-        return getCredentials(false, false);
+    public CredentialWrapper[] getParentCredentials() throws ProcessingException {
+        return getCredentials(false);
     }
 
     /**
      * Returns the credentials of the policy of the selected URL.
      * 
-     * @param urlOnly
-     *            If true, the URL policy credentials are returned. If false,
-     *            the credentials of all ancestor policies are returned.
      * @return An array of CredentialWrappers.
-     * @throws ProcessingException
-     *             when something went wrong.
+     * @throws ProcessingException when something went wrong.
      */
-    public CredentialWrapper[] getCredentials(boolean urlOnly, boolean inherit)
-            throws ProcessingException {
+    public CredentialWrapper[] getCredentials(boolean inherit) throws ProcessingException {
 
         List credentials = new ArrayList();
 
-        ModifiablePolicy policies[] = getPolicies(urlOnly, inherit);
+        ModifiablePolicy policies[] = getPolicies(inherit);
         List policyCredentials = new ArrayList();
         for (int i = 0; i < policies.length; i++) {
             Credential[] creds;
@@ -456,8 +396,7 @@
                 }
             } catch (AccessControlException e) {
                 throw new ProcessingException(
-                        "AccessControlException - receiving credential failed: ",
-                        e);
+                        "AccessControlException - receiving credential failed: ", e);
             }
         }
         for (Iterator i = policyCredentials.iterator(); i.hasNext();) {
@@ -467,51 +406,41 @@
             String method = credential.getMethod();
             credentials.add(new CredentialWrapper(accreditable, role, method));
         }
-        return (CredentialWrapper[]) credentials
-                .toArray(new CredentialWrapper[credentials.size()]);
+        return (CredentialWrapper[]) credentials.toArray(new CredentialWrapper[credentials.size()]);
     }
 
     /**
      * Returns the policies for a certain URL.
      * 
-     * @param onlyUrl
-     *            If true, only the URL policies are returned. Otherwise, all
-     *            ancestor policies are returned.
+     * @param onlyUrl If true, only the URL policies are returned. Otherwise,
+     *        all ancestor policies are returned.
      * @return An array of DefaultPolicy objects.
-     * @throws ProcessingException
-     *             when something went wrong.
+     * @throws ProcessingException when something went wrong.
      */
-    protected ModifiablePolicy[] getPolicies(boolean onlyUrl, boolean inherit)
-            throws ProcessingException {
+    protected ModifiablePolicy[] getPolicies(boolean inherit) throws ProcessingException {
 
         ModifiablePolicy[] policies;
 
         try {
-            if (onlyUrl) {
-                policies = new ModifiablePolicy[1];
-                AccreditableManager policyManager = getAccreditableManager();
-                policies[0] = (ModifiablePolicy) getPolicyManager()
-                        .buildURLPolicy(policyManager, getPolicyURL());
-            } else if (!onlyUrl && inherit) {
+            if (inherit) {
                 policies = new ModifiablePolicy[1];
                 AccreditableManager policyManager = getAccreditableManager();
-                policies[0] = (ModifiablePolicy) getPolicyManager()
-                        .buildSubtreePolicy(policyManager, getPolicyURL());
+                policies[0] = (ModifiablePolicy) getPolicyManager().buildSubtreePolicy(
+                        policyManager, getPolicyURL());
             } else {
                 String ancestorUrl = "";
 
                 String currentUrl = getPolicyURL();
                 if (currentUrl.endsWith("/")) {
-                    currentUrl = currentUrl.substring(0,
-                            currentUrl.length() - 1);
+                    currentUrl = currentUrl.substring(0, currentUrl.length() - 1);
                 }
 
                 int lastSlashIndex = currentUrl.lastIndexOf("/");
                 if (lastSlashIndex != -1) {
                     ancestorUrl = currentUrl.substring(0, lastSlashIndex);
                 }
-                Policy[] pArray = getPolicyManager().getPolicies(
-                        getAccreditableManager(), ancestorUrl);
+                Policy[] pArray = getPolicyManager().getPolicies(getAccreditableManager(),
+                        ancestorUrl);
                 policies = new ModifiablePolicy[pArray.length];
                 for (int i = 0; i < pArray.length; i++) {
                     policies[i] = (ModifiablePolicy) pArray[i];
@@ -529,8 +458,7 @@
         URLInformation info = new URLInformation(infoUrl);
 
         String area = getParameterAsString(AC_AREA);
-        String url = "/" + info.getPublicationId() + "/" + area
-                + info.getDocumentUrl();
+        String url = "/" + info.getPublicationId() + "/" + area + info.getDocumentUrl();
         return url;
     }
 

Modified: lenya/trunk/src/modules-core/sitemanagement/usecases/tab/ac/ac.jx
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/sitemanagement/usecases/tab/ac/ac.jx?view=diff&rev=473418&r1=473417&r2=473418
==============================================================================
--- lenya/trunk/src/modules-core/sitemanagement/usecases/tab/ac/ac.jx (original)
+++ lenya/trunk/src/modules-core/sitemanagement/usecases/tab/ac/ac.jx Fri Nov 10 10:51:30 2006
@@ -31,6 +31,7 @@
     
     <div id="contentblock1" class="lenya-tab-sitetree">
 
+      <!--
       <div class="lenya-box-toggled">
         <div class="lenya-box-title"><i18n:text>Help</i18n:text></div>
         <div class="lenya-box-body">
@@ -39,6 +40,7 @@
           link to the documentation.
         </div>
       </div>
+      -->
       
       <table class="lenya-table">
         <tr>
@@ -53,152 +55,43 @@
           </th>
         </tr>
         <tr>
-          <td colspan="5" style="border-left: 0; border-right: 0; border-bottom: 0px;">
-            <p style="margin: 30px 0 0 0; font-weight: bold;">
-              <i18n:text>URL credentials (only affect this URL)</i18n:text>
+          <td colspan="5" style="border-left: 0; border-right: 0;">
+            <p style="margin: 30px 0 0 0;">
+              <i18n:text>Inherited credentials</i18n:text>
             </p>
           </td>
         </tr>
         <tr>
-          <td colspan="5" style="border-left: 0; border-right: 0; border-top: 0px;">
-              <i18n:text>New URL Credential</i18n:text>
-          </td>
-        </tr>
-        <tr>
-          <th style="font-weight: normal;">Type</th>
+          <th>Type</th>
           <th>Id</th>
           <th>Role</th>
-          <th>Method</th>
-          <th>&#160;
-          </th>
-        </tr>
-        <tr>
-          
-          <form method="get" id="form-addCredential_user">
-            <input type="hidden" name="lenya.usecase"
-              value="${usecase.getName()}"/>
-            <input type="hidden" name="lenya.continuation"
-              value="${continuation.id}"/>
-            <td>
-              <i18n:text>user</i18n:text>
-            </td>
-            <td>
-              <select name="user" class="lenya-form-element-narrow">
-                <jx:forEach var="user" items="${usecase.getParameter('users')}">
-                  <option value="${user}">
-                    <jx:out value="${user}"/>
-                  </option>
-                </jx:forEach>
-              </select>
-            </td>
-            <td>
-              <select name="role" class="lenya-form-element-narrow">
-                <jx:forEach var="role" items="${usecase.getParameter('roles')}">
-                  <option value="${role}">
-                    <jx:out value="${role}"/>
-                  </option>
-                </jx:forEach>
-              </select>
-            </td>
-            <td>
-              <select name="method" class="lenya-form-element-narrow">
-                <option value="deny">Deny</option>
-                <option value="grant">Grant</option>
-              </select>
-            </td>
-            <td>
-              <input i18n:attr="value" type="submit" name="addCredential_user"
-                value="Add"/>
-            </td>
-          </form>
-          
+          <th colspan="2">Method</th>
         </tr>
-        <tr>
-          <form method="get" id="form-addCredential_group">
-            <input type="hidden" name="lenya.usecase"
-              value="${usecase.getName()}"/>
-            <input type="hidden" name="lenya.continuation"
-              value="${continuation.id}"/>
-            <td>
-              <i18n:text>group</i18n:text>
-            </td>
+        <jx:forEach var="credential"
+          items="${usecase.getParameter('parentCredentials')}">
+          <tr>
             <td>
-              <select name="group" class="lenya-form-element-narrow">
-                <jx:forEach var="group" items="${usecase.getParameter('groups')}">
-                  <option value="${group}">
-                    <jx:out value="${group}"/>
-                  </option>
-                </jx:forEach>
-              </select>
+              <i18n:text>
+                <jx:out value="${credential.getType()}"/>
+              </i18n:text>
             </td>
             <td>
-              <select name="role" class="lenya-form-element-narrow">
-                <jx:forEach var="role" items="${usecase.getParameter('roles')}">
-                  <option value="${role}">
-                    <jx:out value="${role}"/>
-                  </option>
-                </jx:forEach>
-              </select>
+              <jx:out value="${credential.getAccreditableId()}"/>
             </td>
             <td>
-              <select name="method" class="lenya-form-element-narrow">
-                <option value="deny">Deny</option>
-                <option value="grant">Grant</option>
-              </select>
+              <jx:out value="${credential.getRoleId()}"/>
             </td>
-            <td>
-              <input i18n:attr="value" type="submit" name="addCredential_group"
-                value="Add"/>
+            <td colspan="2">
+              <jx:out value="${credential.getMethod()}"/>
             </td>
-          </form>
-        </tr>
-        <jx:if test="${area.equals('live')}">
-          <tr>
-            <form method="get" id="form-addCredential_ipRange">
-              <input type="hidden" name="lenya.usecase"
-                value="${usecase.getName()}"/>
-              <input type="hidden" name="lenya.continuation"
-                value="${continuation.id}"/>
-              <td>
-                <i18n:text>IP Range</i18n:text>
-              </td>
-              <td>
-                <select name="ipRange" class="lenya-form-element-narrow">
-                  <jx:forEach var="ipRange"
-                    items="${usecase.getParameter('ipRanges')}">
-                    <option value="${ipRange}">
-                      <jx:out value="${ipRange}"/>
-                    </option>
-                  </jx:forEach>
-                </select>
-              </td>
-              <td>
-                <select name="role" class="lenya-form-element-narrow">
-                  <jx:forEach var="role" items="${usecase.getParameter('roles')}">
-                    <option value="${role}">
-                      <jx:out value="${role}"/>
-                    </option>
-                  </jx:forEach>
-                </select>
-              </td>
-              <td>
-                <select name="method" class="lenya-form-element-narrow">
-                  <option value="deny">Deny</option>
-                  <option value="grant">Grant</option>
-                </select>
-              </td>
-              <td>
-                <input i18n:attr="value" type="submit" name="addCredential_ipRange"
-                  value="Add"/>
-              </td>
-            </form>
           </tr>
-        </jx:if>
+        </jx:forEach>
+        
         
         <tr>
           <td colspan="5" style="border-left: 0; border-right: 0;">
-            <p style="margin: 30px 0 0 0; font-weight: bold;">
-              <i18n:text>Stored URL credentials</i18n:text> 
+            <p style="margin: 30px 0 0 0;">
+              <i18n:text>Subtree credentials</i18n:text>
             </p>
           </td>
         </tr>
@@ -210,9 +103,9 @@
           <th>&#160;
           </th>
         </tr>
-        <jx:forEach var="credential"
-          items="${usecase.getParameter('urlCredentials')}" varStatus="status">
-          <form method="get" id="form-deleteCredential">
+        <jx:forEach var="credential" varStatus="status"
+          items="${usecase.getParameter('subCredentials')}">
+          <form method="get" id="form-deleteSubCredential">
             <input type="hidden" name="lenya.usecase"
               value="${usecase.getName()}"/>
             <input type="hidden" name="lenya.continuation"
@@ -240,15 +133,16 @@
               </td>
               <td>
                 <input type="submit"
-                  name="deleteCredential_${credential.getType()}"
+                  name="deleteCredential_sub${credential.getType()}"
                   i18n:attr="value" value="Delete"/>
                 <jx:if test="${status.count>1}">
-                  <input type="submit" name="upCredential_${credential.getType()}"
+                  <input type="submit"
+                    name="upCredential_sub${credential.getType()}"
                     i18n:attr="value" value="Move Up"/>
                 </jx:if>
                 <jx:if test="${!status.last}">
                   <input type="submit"
-                    name="downCredential_${credential.getType()}"
+                    name="downCredential_sub${credential.getType()}"
                     i18n:attr="value" value="Move Down"/>
                 </jx:if>
               </td>
@@ -257,19 +151,10 @@
         </jx:forEach>
         
         <tr>
-          <td colspan="5">&#160;
-          </td>
-        </tr>
-        <tr>
-          <td colspan="5" style="border-left: 0; border-right: 0; border-bottom: 0px;">
-            <p style="margin: 30px 0 0 0; font-weight: bold;">
-              <i18n:text>Inherited credentials (affect this URL and all descendant URLs)</i18n:text> 
-            </p>
-          </td>
-        </tr>
-        <tr>
           <td colspan="5" style="border-left: 0; border-right: 0; border-top: 0px;">
-            <i18n:text>New inheritable credential</i18n:text>
+            <p style="margin: 30px 0 0 0;">
+              <i18n:text>New subtree credential</i18n:text>
+            </p>
           </td>
         </tr>
         <tr>
@@ -360,100 +245,6 @@
             </td>
           </form>
         </tr>
-        <tr>
-          <td colspan="5" style="border-left: 0; border-right: 0;">
-            <p style="margin: 30px 0 0 0; font-weight: bold;">
-              <i18n:text>From here</i18n:text>
-            </p>
-          </td>
-        </tr>
-        <tr>
-          <th>Type</th>
-          <th>Id</th>
-          <th>Role</th>
-          <th>Method</th>
-          <th>&#160;
-          </th>
-        </tr>
-        <jx:forEach var="credential" varStatus="status"
-          items="${usecase.getParameter('subCredentials')}">
-          <form method="get" id="form-deleteSubCredential">
-            <input type="hidden" name="lenya.usecase"
-              value="${usecase.getName()}"/>
-            <input type="hidden" name="lenya.continuation"
-              value="${continuation.id}"/>
-            <tr>
-              <td>
-                <i18n:text>
-                  <jx:out value="${credential.getType()}"/>
-                </i18n:text>
-              </td>
-              <td>
-                <input type="hidden" name="${credential.getType()}"
-                  value="${credential.getAccreditableId()}"/>
-                <jx:out value="${credential.getAccreditableId()}"/>
-              </td>
-              <td>
-                <input type="hidden" name="role"
-                  value="${credential.getRoleId()}"/>
-                <jx:out value="${credential.getRoleId()}"/>
-              </td>
-              <td>
-                <input type="hidden" name="method"
-                  value="${credential.getMethod()}"/>
-                <jx:out value="${credential.getMethod()}"/>
-              </td>
-              <td>
-                <input type="submit"
-                  name="deleteCredential_sub${credential.getType()}"
-                  i18n:attr="value" value="Delete"/>
-                <jx:if test="${status.count>1}">
-                  <input type="submit"
-                    name="upCredential_sub${credential.getType()}"
-                    i18n:attr="value" value="Move Up"/>
-                </jx:if>
-                <jx:if test="${!status.last}">
-                  <input type="submit"
-                    name="downCredential_sub${credential.getType()}"
-                    i18n:attr="value" value="Move Down"/>
-                </jx:if>
-              </td>
-            </tr>
-          </form>
-        </jx:forEach>
-        
-        <tr>
-          <td colspan="5" style="border-left: 0; border-right: 0;">
-            <p style="margin: 30px 0 0 0; font-weight: bold;">
-              <i18n:text>From parents (starting with direct parent)</i18n:text>
-            </p>
-          </td>
-        </tr>
-        <tr>
-          <th>Type</th>
-          <th>Id</th>
-          <th>Role</th>
-          <th colspan="2">Method</th>
-        </tr>
-        <jx:forEach var="credential"
-          items="${usecase.getParameter('parentCredentials')}">
-          <tr>
-            <td>
-              <i18n:text>
-                <jx:out value="${credential.getType()}"/>
-              </i18n:text>
-            </td>
-            <td>
-              <jx:out value="${credential.getAccreditableId()}"/>
-            </td>
-            <td>
-              <jx:out value="${credential.getRoleId()}"/>
-            </td>
-            <td colspan="2">
-              <jx:out value="${credential.getMethod()}"/>
-            </td>
-          </tr>
-        </jx:forEach>
         
       </table>
     </div>



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