jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1368553 - /jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java
Date Thu, 02 Aug 2012 15:40:06 GMT
Author: jukka
Date: Thu Aug  2 15:40:06 2012
New Revision: 1368553

URL: http://svn.apache.org/viewvc?rev=1368553&view=rev
Log:
OAK-51: Implement JCR Access Control Management

Add a dummy access control manager to enable clients that expect one to be present.

Modified:
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java?rev=1368553&r1=1368552&r2=1368553&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java
Thu Aug  2 15:40:06 2012
@@ -39,11 +39,15 @@ import javax.jcr.ValueFactory;
 import javax.jcr.Workspace;
 import javax.jcr.retention.RetentionManager;
 import javax.jcr.security.AccessControlManager;
+import javax.jcr.security.AccessControlPolicy;
+import javax.jcr.security.AccessControlPolicyIterator;
+import javax.jcr.security.Privilege;
 
 import org.apache.jackrabbit.api.JackrabbitSession;
 import org.apache.jackrabbit.api.security.principal.PrincipalManager;
 import org.apache.jackrabbit.api.security.user.UserManager;
 import org.apache.jackrabbit.commons.AbstractSession;
+import org.apache.jackrabbit.commons.iterator.AccessControlPolicyIteratorAdapter;
 import org.apache.jackrabbit.oak.commons.PathUtils;
 import org.apache.jackrabbit.oak.jcr.security.principal.PrincipalManagerImpl;
 import org.apache.jackrabbit.oak.jcr.security.user.UserManagerConfig;
@@ -353,9 +357,47 @@ public class SessionImpl extends Abstrac
 
     @Override
     @Nonnull
-    public AccessControlManager getAccessControlManager() throws RepositoryException {
-        ensureIsAlive();
-        throw new UnsupportedRepositoryOperationException("TODO: Session.getAccessControlManager");
+    public AccessControlManager getAccessControlManager()
+            throws RepositoryException {
+        return TODO.dummyImplementation().returnValue(new AccessControlManager() {
+            @Override
+            public void setPolicy(String absPath, AccessControlPolicy policy) {
+                // do nothing
+            }
+            @Override
+            public void removePolicy(String absPath, AccessControlPolicy policy) {
+                // do nothing
+            }
+            @Override
+            public Privilege privilegeFromName(String privilegeName)
+                    throws AccessControlException {
+                throw new AccessControlException(privilegeName);
+            }
+            @Override
+            public boolean hasPrivileges(String absPath, Privilege[] privileges) {
+                return true;
+            }
+            @Override
+            public Privilege[] getSupportedPrivileges(String absPath) {
+                return new Privilege[0];
+            }
+            @Override
+            public Privilege[] getPrivileges(String absPath) {
+                return new Privilege[0];
+            }
+            @Override
+            public AccessControlPolicy[] getPolicies(String absPath) {
+                return new AccessControlPolicy[0];
+            }
+            @Override
+            public AccessControlPolicy[] getEffectivePolicies(String absPath) {
+                return new AccessControlPolicy[0];
+            }
+            @Override
+            public AccessControlPolicyIterator getApplicablePolicies(String absPath) {
+                return AccessControlPolicyIteratorAdapter.EMPTY;
+            }
+        });
     }
 
     /**



Mime
View raw message