jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1470452 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege: PrivilegeDefinitionReader.java PrivilegeManagerImpl.java
Date Mon, 22 Apr 2013 11:08:05 GMT
Author: angela
Date: Mon Apr 22 11:08:05 2013
New Revision: 1470452

URL: http://svn.apache.org/r1470452
Log:
OAK-64: privilege mgt (minor improvement)

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeDefinitionReader.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeManagerImpl.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeDefinitionReader.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeDefinitionReader.java?rev=1470452&r1=1470451&r2=1470452&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeDefinitionReader.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeDefinitionReader.java
Mon Apr 22 11:08:05 2013
@@ -21,6 +21,7 @@ import java.util.HashMap;
 import java.util.Map;
 import javax.annotation.CheckForNull;
 import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
 
 import org.apache.jackrabbit.oak.api.Root;
 import org.apache.jackrabbit.oak.api.Tree;
@@ -51,8 +52,10 @@ class PrivilegeDefinitionReader implemen
         } else {
             Map<String, PrivilegeDefinition> definitions = new HashMap<String, PrivilegeDefinition>();
             for (Tree child : privilegesTree.getChildren()) {
-                PrivilegeDefinition def = readDefinition(child);
-                definitions.put(def.getName(), def);
+                if (isPrivilegeDefinition(child)) {
+                    PrivilegeDefinition def = readDefinition(child);
+                    definitions.put(def.getName(), def);
+                }
             }
             return definitions;
         }
@@ -71,7 +74,7 @@ class PrivilegeDefinitionReader implemen
             return null;
         } else {
             Tree definitionTree = privilegesTree.getChild(privilegeName);
-            return (definitionTree == null) ? null : readDefinition(definitionTree);
+            return (isPrivilegeDefinition(definitionTree)) ? readDefinition(definitionTree)
: null;
         }
     }
 
@@ -87,4 +90,8 @@ class PrivilegeDefinitionReader implemen
 
         return new PrivilegeDefinitionImpl(name, isAbstract, declAggrNames);
     }
+
+    private static boolean isPrivilegeDefinition(@Nullable Tree tree) {
+        return tree != null && NT_REP_PRIVILEGE.equals(TreeUtil.getPrimaryTypeName(tree));
+    }
 }
\ No newline at end of file

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeManagerImpl.java?rev=1470452&r1=1470451&r2=1470452&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeManagerImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeManagerImpl.java
Mon Apr 22 11:08:05 2013
@@ -39,18 +39,19 @@ import org.slf4j.LoggerFactory;
  * {@code PrivilegeManager} implementation reading from and storing privileges
  * into the repository.
  */
-public class PrivilegeManagerImpl implements PrivilegeManager {
+class PrivilegeManagerImpl implements PrivilegeManager {
 
     private static final Logger log = LoggerFactory.getLogger(PrivilegeManagerImpl.class);
 
     private final Root root;
     private final NamePathMapper namePathMapper;
 
-    public PrivilegeManagerImpl(Root root, NamePathMapper namePathMapper) {
+    PrivilegeManagerImpl(Root root, NamePathMapper namePathMapper) {
         this.root = root;
         this.namePathMapper = namePathMapper;
     }
 
+    //---------------------------------------------------< PrivilegeManager >---
     @Override
     public Privilege[] getRegisteredPrivileges() throws RepositoryException {
         Set<Privilege> privileges = new HashSet<Privilege>();



Mime
View raw message