jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1559170 - in /jackrabbit/oak/trunk/oak-core/src: main/java/org/apache/jackrabbit/oak/security/authorization/permission/ main/java/org/apache/jackrabbit/oak/spi/security/authorization/accesscontrol/ main/java/org/apache/jackrabbit/oak/spi/s...
Date Fri, 17 Jan 2014 16:33:26 GMT
Author: angela
Date: Fri Jan 17 16:33:26 2014
New Revision: 1559170

URL: http://svn.apache.org/r1559170
Log:
OAK-527 

Implement Permission evaluation 

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/CompiledPermissionImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/CompiledPermissions.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/PermissionProviderImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authorization/accesscontrol/AbstractAccessControlManager.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authorization/permission/PermissionProvider.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/permission/PermissionProviderImplTest.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/CompiledPermissionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/CompiledPermissionImpl.java?rev=1559170&r1=1559169&r2=1559170&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/CompiledPermissionImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/CompiledPermissionImpl.java
Fri Jan 17 16:33:26 2014
@@ -246,7 +246,7 @@ final class CompiledPermissionImpl imple
     }
 
     @Override
-    public boolean hasPrivileges(@Nullable ImmutableTree tree, String... privilegeNames)
{
+    public boolean hasPrivileges(@Nullable ImmutableTree tree, @Nonnull String... privilegeNames)
{
         return internalGetPrivileges(tree).includes(bitsProvider.getBits(privilegeNames));
     }
 

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/CompiledPermissions.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/CompiledPermissions.java?rev=1559170&r1=1559169&r2=1559170&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/CompiledPermissions.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/CompiledPermissions.java
Fri Jan 17 16:33:26 2014
@@ -71,5 +71,5 @@ public interface CompiledPermissions {
      * @param privilegeNames
      * @return
      */
-    boolean hasPrivileges(@Nullable ImmutableTree tree, String... privilegeNames);
+    boolean hasPrivileges(@Nullable ImmutableTree tree, @Nonnull String... privilegeNames);
 }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/PermissionProviderImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/PermissionProviderImpl.java?rev=1559170&r1=1559169&r2=1559170&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/PermissionProviderImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/PermissionProviderImpl.java
Fri Jan 17 16:33:26 2014
@@ -86,7 +86,7 @@ public class PermissionProviderImpl impl
     }
 
     @Override
-    public boolean hasPrivileges(@Nullable Tree tree, String... privilegeNames) {
+    public boolean hasPrivileges(@Nullable Tree tree, @Nonnull String... privilegeNames)
{
         return compiledPermissions.hasPrivileges(getImmutableTree(tree), privilegeNames);
     }
 

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authorization/accesscontrol/AbstractAccessControlManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authorization/accesscontrol/AbstractAccessControlManager.java?rev=1559170&r1=1559169&r2=1559170&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authorization/accesscontrol/AbstractAccessControlManager.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authorization/accesscontrol/AbstractAccessControlManager.java
Fri Jan 17 16:33:26 2014
@@ -227,8 +227,8 @@ public abstract class AbstractAccessCont
     }
 
     private boolean hasPrivileges(@Nullable String absPath, @Nullable Privilege[] privileges,
-                                    @Nonnull PermissionProvider provider, long permissions,
-                                    boolean checkAcContent) throws RepositoryException {
+                                  @Nonnull PermissionProvider provider, long permissions,
+                                  boolean checkAcContent) throws RepositoryException {
         Tree tree;
         if (absPath == null) {
             tree = null;

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authorization/permission/PermissionProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authorization/permission/PermissionProvider.java?rev=1559170&r1=1559169&r2=1559170&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authorization/permission/PermissionProvider.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authorization/permission/PermissionProvider.java
Fri Jan 17 16:33:26 2014
@@ -47,7 +47,7 @@ public interface PermissionProvider {
      * @param privilegeNames
      * @return
      */
-    boolean hasPrivileges(@Nullable Tree tree, String... privilegeNames);
+    boolean hasPrivileges(@Nullable Tree tree, @Nonnull String... privilegeNames);
 
     RepositoryPermission getRepositoryPermission();
 

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/permission/PermissionProviderImplTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/permission/PermissionProviderImplTest.java?rev=1559170&r1=1559169&r2=1559170&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/permission/PermissionProviderImplTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/permission/PermissionProviderImplTest.java
Fri Jan 17 16:33:26 2014
@@ -106,6 +106,20 @@ public class PermissionProviderImplTest 
     }
 
     @Test
+    public void testHasPrivileges() throws Exception {
+        ContentSession testSession = createTestSession();
+        try {
+            PermissionProvider pp = createPermissionProvider(testSession);
+
+            assertTrue(pp.hasPrivileges(null));
+            assertTrue(pp.hasPrivileges(null, new String[0]));
+            assertFalse(pp.hasPrivileges(null, PrivilegeConstants.JCR_WORKSPACE_MANAGEMENT));
+        } finally {
+            testSession.close();
+        }
+    }
+
+    @Test
     public void testReadPath() throws Exception {
         ContentSession testSession = createTestSession();
         try {



Mime
View raw message