jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1346783 - in /jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user: AuthorizableNodeCreator.java UserManagerConfig.java
Date Wed, 06 Jun 2012 08:45:23 GMT
Author: angela
Date: Wed Jun  6 08:45:22 2012
New Revision: 1346783

URL: http://svn.apache.org/viewvc?rev=1346783&view=rev
Log:
OAK-50 : Implement User Management (WIP)

Modified:
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/AuthorizableNodeCreator.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/UserManagerConfig.java

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/AuthorizableNodeCreator.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/AuthorizableNodeCreator.java?rev=1346783&r1=1346782&r2=1346783&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/AuthorizableNodeCreator.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/AuthorizableNodeCreator.java
Wed Jun  6 08:45:22 2012
@@ -309,15 +309,15 @@ class AuthorizableNodeCreator {
             sb.append(intermediatePath);
         } else {
             int idLength = authorizableId.length();
+            StringBuilder segment = new StringBuilder();
             for (int i = 0; i < defaultDepth; i++) {
-                char c;
                 if (idLength > i) {
-                    c = authorizableId.charAt(i);
+                    segment.append(authorizableId.charAt(i));
                 } else {
                     // escapedID is too short -> append the last char again
-                    c = authorizableId.charAt(idLength-1);
+                    segment.append(authorizableId.charAt(idLength-1));
                 }
-                sb.append(DELIMITER).append(Text.escapeIllegalJcrChars(String.valueOf(c)));
+                sb.append(DELIMITER).append(Text.escapeIllegalJcrChars(segment.toString()));
             }
         }
         return sb.toString();
@@ -369,7 +369,7 @@ class AuthorizableNodeCreator {
                 }
             } else {
                 // folder doesn't exist nor does another colliding child node.
-                folder = folder.addNode(folderName, ntAuthorizable);
+                folder = folder.addNode(folderName, ntAuthorizableFolder);
             }
             segmLength++;
         }

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/UserManagerConfig.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/UserManagerConfig.java?rev=1346783&r1=1346782&r2=1346783&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/UserManagerConfig.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/UserManagerConfig.java
Wed Jun  6 08:45:22 2012
@@ -23,6 +23,7 @@ import org.slf4j.LoggerFactory;
 import java.util.Collections;
 import java.util.Map;
 import java.util.Set;
+import javax.annotation.Nonnull;
 
 /**
  * UserManagerConfig...
@@ -104,28 +105,32 @@ public class UserManagerConfig {
      */
     public static final String PARAM_PASSWORD_SALT_SIZE = "passwordSaltSize";
 
-    private final Map<String, Object> config;
     private final String adminId;
+    private final Map<String, Object> options;
     private final Set<AuthorizableAction> actions;
 
-    public UserManagerConfig(Map<String, Object> config, String adminId, Set<AuthorizableAction>
actions) {
-        this.config = config;
+    public UserManagerConfig(String adminId, Map<String, Object> options, Set<AuthorizableAction>
actions) {
+        assert adminId != null;
+
         this.adminId = adminId;
+        this.options = (options == null) ? Collections.<String, Object>emptyMap() :
Collections.unmodifiableMap(options);
         this.actions = (actions == null) ? Collections.<AuthorizableAction>emptySet()
: Collections.unmodifiableSet(actions);
     }
 
+    @Nonnull
+    public String getAdminId() {
+        return adminId;
+    }
+
     public <T> T getConfigValue(String key, T defaultValue) {
-        if (config != null && config.containsKey(key)) {
-            return convert(config.get(key), defaultValue);
+        if (options != null && options.containsKey(key)) {
+            return convert(options.get(key), defaultValue);
         } else {
             return defaultValue;
         }
     }
 
-    public String getAdminId() {
-        return adminId;
-    }
-
+    @Nonnull
     public AuthorizableAction[] getAuthorizableActions() {
         return actions.toArray(new AuthorizableAction[actions.size()]);
     }



Mime
View raw message