jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1459704 - in /jackrabbit/oak/trunk/oak-core/src: main/java/org/apache/jackrabbit/oak/security/authorization/permission/ test/java/org/apache/jackrabbit/oak/security/authorization/permission/
Date Fri, 22 Mar 2013 10:49:36 GMT
Author: angela
Date: Fri Mar 22 10:49:36 2013
New Revision: 1459704

URL: http://svn.apache.org/r1459704
Log:
OAK-527: permissions (wip)

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/AllPermissions.java
    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/NoPermissions.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/PermissionProviderImpl.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/permission/AllPermissionsTest.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/AllPermissions.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/AllPermissions.java?rev=1459704&r1=1459703&r2=1459704&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/AllPermissions.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/AllPermissions.java
Fri Mar 22 10:49:36 2013
@@ -49,11 +49,6 @@ public final class AllPermissions implem
     }
 
     @Override
-    public boolean isGranted(Tree tree, long permissions) {
-        return true;
-    }
-
-    @Override
     public boolean isGranted(Tree parent, PropertyState property, long permissions) {
         return true;
     }

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=1459704&r1=1459703&r2=1459704&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 Mar 22 10:49:36 2013
@@ -123,13 +123,8 @@ class CompiledPermissionImpl implements 
     }
 
     @Override
-    public boolean isGranted(Tree tree, long permissions) {
-        return hasPermissions(tree, permissions, filterEntries(tree, null));
-    }
-
-    @Override
-    public boolean isGranted(Tree parent, PropertyState property, long permissions) {
-        return hasPermissions(parent, permissions, filterEntries(parent, property));
+    public boolean isGranted(@Nonnull Tree tree, @Nullable PropertyState property, long permissions)
{
+        return hasPermissions(tree, permissions, filterEntries(tree, property));
     }
 
     @Override

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=1459704&r1=1459703&r2=1459704&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 Mar 22 10:49:36 2013
@@ -34,9 +34,7 @@ public interface CompiledPermissions {
 
     boolean isGranted(long permissions);
 
-    boolean isGranted(@Nonnull Tree tree, long permissions);
-
-    boolean isGranted(@Nonnull Tree parent, @Nonnull PropertyState property, long permissions);
+    boolean isGranted(@Nonnull Tree parent, @Nullable PropertyState property, long permissions);
 
     boolean isGranted(@Nonnull String path, long permissions);
 

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/NoPermissions.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/NoPermissions.java?rev=1459704&r1=1459703&r2=1459704&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/NoPermissions.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/NoPermissions.java
Fri Mar 22 10:49:36 2013
@@ -50,12 +50,7 @@ public final class NoPermissions impleme
     }
 
     @Override
-    public boolean isGranted(@Nonnull Tree tree, long permissions) {
-        return false;
-    }
-
-    @Override
-    public boolean isGranted(@Nonnull Tree parent, @Nonnull PropertyState property, long
permissions) {
+    public boolean isGranted(@Nonnull Tree parent, @Nullable PropertyState property, long
permissions) {
         return false;
     }
 

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=1459704&r1=1459703&r2=1459704&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 Mar 22 10:49:36 2013
@@ -48,7 +48,6 @@ import org.apache.jackrabbit.oak.util.Tr
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import static com.google.common.base.Preconditions.checkArgument;
 import static com.google.common.base.Preconditions.checkNotNull;
 
 /**
@@ -128,8 +127,6 @@ public class PermissionProviderImpl impl
         if (isVersionContent(tree)) {
             String path = getVersionablePath(tree, property);
             return path != null && compiledPermissions.isGranted(path, permissions);
-        } else if (property == null) {
-            return compiledPermissions.isGranted(tree, permissions);
         } else {
             return compiledPermissions.isGranted(tree, property, permissions);
         }
@@ -195,11 +192,7 @@ public class PermissionProviderImpl impl
     }
 
     private boolean canReadAccessControlContent(@Nonnull Tree acTree, @Nullable PropertyState
acProperty) {
-        if (acProperty != null) {
-            return compiledPermissions.isGranted(acTree, acProperty, Permissions.READ_ACCESS_CONTROL);
-        } else {
-            return compiledPermissions.isGranted(acTree, Permissions.READ_ACCESS_CONTROL);
-        }
+        return compiledPermissions.isGranted(acTree, acProperty, Permissions.READ_ACCESS_CONTROL);
     }
 
     private static boolean isVersionContent(@Nonnull Tree tree) {

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/permission/AllPermissionsTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/permission/AllPermissionsTest.java?rev=1459704&r1=1459703&r2=1459704&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/permission/AllPermissionsTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/permission/AllPermissionsTest.java
Fri Mar 22 10:49:36 2013
@@ -73,12 +73,12 @@ public class AllPermissionsTest extends 
             Tree tree = root.getTree(path);
             assertNotNull(tree);
 
-            assertTrue(all.isGranted(tree, Permissions.ALL));
+            assertTrue(all.isGranted(tree, null, Permissions.ALL));
             for (PropertyState prop : tree.getProperties()) {
                 assertTrue(all.isGranted(tree, prop, Permissions.ALL));
             }
             for (Tree child : tree.getChildren()) {
-                assertTrue(all.isGranted(child, Permissions.ALL));
+                assertTrue(all.isGranted(child, null, Permissions.ALL));
             }
         }
     }



Mime
View raw message