jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1537546 - in /jackrabbit/trunk: jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/
Date Thu, 31 Oct 2013 16:30:59 GMT
Author: angela
Date: Thu Oct 31 16:30:58 2013
New Revision: 1537546

URL: http://svn.apache.org/r1537546
Log:
JCR-3641 : provide ability to create JackrabbitAccessControlEntry with multi-valued restrictions

Modified:
    jackrabbit/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/JackrabbitAccessControlList.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/AbstractACLTemplate.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/UnmodifiableAccessControlList.java

Modified: jackrabbit/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/JackrabbitAccessControlList.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/JackrabbitAccessControlList.java?rev=1537546&r1=1537545&r2=1537546&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/JackrabbitAccessControlList.java
(original)
+++ jackrabbit/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/JackrabbitAccessControlList.java
Thu Oct 31 16:30:58 2013
@@ -16,16 +16,16 @@
  */
 package org.apache.jackrabbit.api.security;
 
+import java.security.Principal;
+import java.util.Map;
 import javax.jcr.RepositoryException;
-import javax.jcr.Value;
 import javax.jcr.UnsupportedRepositoryOperationException;
+import javax.jcr.Value;
+import javax.jcr.security.AccessControlEntry;
 import javax.jcr.security.AccessControlException;
 import javax.jcr.security.AccessControlList;
 import javax.jcr.security.AccessControlPolicy;
 import javax.jcr.security.Privilege;
-import javax.jcr.security.AccessControlEntry;
-import java.security.Principal;
-import java.util.Map;
 
 /**
  * <code>JackrabbitAccessControlList</code> is an extension of the <code>AccessControlList</code>.
@@ -118,6 +118,39 @@ public interface JackrabbitAccessControl
             throws AccessControlException, RepositoryException;
 
     /**
+     * Adds an access control entry to this policy consisting of the specified
+     * <code>principal</code>, the specified <code>privileges</code>,
the
+     * <code>isAllow</code> flag and an optional map containing additional
+     * restrictions.
+     * <p/>
+     * This method returns <code>true</code> if this policy was modified,
+     * <code>false</code> otherwise.
+     * <p/>
+     * An <code>AccessControlException</code> is thrown if any of the specified
+     * parameters is invalid or if some other access control related exception occurs.
+     *
+     * @param principal the principal to add the entry for
+     * @param privileges the privileges to add
+     * @param isAllow if <code>true</code> if this is a positive (allow) entry
+     * @param restrictions A map of additional restrictions used to narrow the
+     * effect of the entry to be created. The map must map JCR names to a single
+     * {@link javax.jcr.Value} object.
+     * @param restrictions A map of additional multivalued restrictions used to narrow the
+     * effect of the entry to be created. The map must map JCR names to a
+     * {@link javax.jcr.Value} array.
+     * @return true if this policy has changed by incorporating the given entry;
+     * false otherwise.
+     * @throws AccessControlException If any of the given parameter is invalid
+     * or cannot be handled by the implementation.
+     * @throws RepositoryException If another error occurs.
+     * @see AccessControlList#addAccessControlEntry(Principal, Privilege[])
+     */
+    boolean addEntry(Principal principal, Privilege[] privileges,
+                     boolean isAllow, Map<String, Value> restrictions,
+                     Map<String, Value[]> mvRestrictions)
+            throws AccessControlException, RepositoryException;
+
+    /**
      * If the <code>AccessControlList</code> implementation supports
      * reordering of entries the specified <code>srcEntry</code> is inserted
      * at the position of the specified <code>destEntry</code>.<p/>

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/AbstractACLTemplate.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/AbstractACLTemplate.java?rev=1537546&r1=1537545&r2=1537546&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/AbstractACLTemplate.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/AbstractACLTemplate.java
Thu Oct 31 16:30:58 2013
@@ -98,6 +98,17 @@ public abstract class AbstractACLTemplat
     }
 
     /**
+     * @see org.apache.jackrabbit.api.security.JackrabbitAccessControlList#addEntry(Principal,
Privilege[], boolean, Map, Map)
+     */
+    public boolean addEntry(Principal principal, Privilege[] privileges, boolean isAllow,
Map<String, Value> restrictions, Map<String, Value[]> mvRestrictions) throws AccessControlException,
RepositoryException {
+        if (mvRestrictions == null || mvRestrictions.isEmpty()) {
+            return addEntry(principal, privileges, isAllow, restrictions);
+        } else {
+            throw new UnsupportedRepositoryOperationException("Not implemented. Please use
Jackrabbit OAK to get support for multi-valued restrictions.");
+        }
+    }
+
+    /**
      * @see org.apache.jackrabbit.api.security.JackrabbitAccessControlList#size()
      */
     public int size() {

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/UnmodifiableAccessControlList.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/UnmodifiableAccessControlList.java?rev=1537546&r1=1537545&r2=1537546&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/UnmodifiableAccessControlList.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/UnmodifiableAccessControlList.java
Thu Oct 31 16:30:58 2013
@@ -171,6 +171,10 @@ public class UnmodifiableAccessControlLi
         throw new AccessControlException("Unmodifiable ACL. Use AccessControlManager#getPolicy
or #getApplicablePolicies in order to obtain an modifiable ACL.");
     }
 
+    public boolean addEntry(Principal principal, Privilege[] privileges, boolean isAllow,
Map<String, Value> restrictions, Map<String, Value[]> mvRestrictions) throws AccessControlException,
RepositoryException {
+        throw new AccessControlException("Unmodifiable ACL. Use AccessControlManager#getPolicy
or #getApplicablePolicies in order to obtain an modifiable ACL.");
+    }
+
     /**
      * @see org.apache.jackrabbit.api.security.JackrabbitAccessControlList#orderBefore(AccessControlEntry,
AccessControlEntry)
      */



Mime
View raw message