jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1451289 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/CompiledPermissionImpl.java
Date Thu, 28 Feb 2013 18:48:22 GMT
Author: angela
Date: Thu Feb 28 18:48:21 2013
New Revision: 1451289

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

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/CompiledPermissionImpl.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=1451289&r1=1451288&r2=1451289&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
Thu Feb 28 18:48:21 2013
@@ -18,6 +18,7 @@ package org.apache.jackrabbit.oak.securi
 
 import java.security.Principal;
 import java.security.acl.Group;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -30,7 +31,6 @@ import com.google.common.collect.Immutab
 import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.api.Tree;
 import org.apache.jackrabbit.oak.api.Type;
-import org.apache.jackrabbit.oak.core.ReadOnlyRoot;
 import org.apache.jackrabbit.oak.core.ReadOnlyTree;
 import org.apache.jackrabbit.oak.security.authorization.AccessControlConstants;
 import org.apache.jackrabbit.oak.security.privilege.PrivilegeBits;
@@ -62,7 +62,7 @@ class CompiledPermissionImpl implements 
         update(permissionsTree, bitsProvider);
     }
 
-    void update(@Nonnull ReadOnlyTree permissionsTree, @Nonnull PrivilegeBitsProvider bitsProvider)
{
+    void update(@Nullable ReadOnlyTree permissionsTree, @Nonnull PrivilegeBitsProvider bitsProvider)
{
         // TODO: determine if entries need to be reloaded due to changes to the
         // TODO: affected permission-nodes.
         this.bitsProvider = bitsProvider;
@@ -114,17 +114,22 @@ class CompiledPermissionImpl implements 
 
     //------------------------------------------------------------< private >---
 
-    private void buildEntries(ReadOnlyTree permissionsTree) {
-        EntriesBuilder builder = new EntriesBuilder();
-        for (Principal principal : principals) {
-            ReadOnlyTree t = getPrincipalRoot(permissionsTree, principal);
-            if (t != null) {
-                trees.put(principal.getName(), t);
-                builder.addEntry(principal, t);
+    private void buildEntries(@Nullable ReadOnlyTree permissionsTree) {
+        if (permissionsTree == null) {
+            userEntries = Collections.emptyMap();
+            groupEntries = Collections.emptyMap();
+        } else {
+            EntriesBuilder builder = new EntriesBuilder();
+            for (Principal principal : principals) {
+                ReadOnlyTree t = getPrincipalRoot(permissionsTree, principal);
+                if (t != null) {
+                    trees.put(principal.getName(), t);
+                    builder.addEntry(principal, t);
+                }
             }
+            userEntries = builder.userEntries.build();
+            groupEntries = builder.groupEntries.build();
         }
-        userEntries = builder.userEntries.build();
-        groupEntries = builder.groupEntries.build();
     }
 
     @CheckForNull



Mime
View raw message