jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1414684 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/MembershipProvider.java
Date Wed, 28 Nov 2012 13:48:42 GMT
Author: angela
Date: Wed Nov 28 13:48:41 2012
New Revision: 1414684

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

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/MembershipProvider.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/MembershipProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/MembershipProvider.java?rev=1414684&r1=1414683&r2=1414684&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/MembershipProvider.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/MembershipProvider.java
Wed Nov 28 13:48:41 2012
@@ -192,10 +192,7 @@ class MembershipProvider extends Authori
             // TODO: add implementation that allows to index group members
             throw new UnsupportedOperationException("not implemented: addMember with member-node
hierarchy");
         } else {
-            PropertyState property = groupTree.getProperty(REP_MEMBERS);
-            PropertyBuilder<String> propertyBuilder = property == null
-                ? MemoryPropertyBuilder.array(WEAKREFERENCE, REP_MEMBERS)
-                : MemoryPropertyBuilder.copy(WEAKREFERENCE, property);
+            PropertyBuilder<String> propertyBuilder = getMembersPropertyBuilder(groupTree);
             if (propertyBuilder.hasValue(memberContentId)) {
                 return false;
             } else {
@@ -215,11 +212,7 @@ class MembershipProvider extends Authori
             }
         } else {
             String toRemove = getContentID(memberTree);
-            // FIXME: remove usage of MemoryPropertyBuilder (OAK-372)
-            PropertyState property = groupTree.getProperty(REP_MEMBERS);
-            PropertyBuilder<String> propertyBuilder = property == null
-                ? MemoryPropertyBuilder.array(WEAKREFERENCE, REP_MEMBERS)
-                : MemoryPropertyBuilder.copy(WEAKREFERENCE, property);
+            PropertyBuilder<String> propertyBuilder = getMembersPropertyBuilder(groupTree);
             if (propertyBuilder.hasValue(toRemove)) {
                 propertyBuilder.removeValue(toRemove);
                 if (propertyBuilder.isEmpty()) {
@@ -238,6 +231,16 @@ class MembershipProvider extends Authori
 
     //-----------------------------------------< private MembershipProvider >---
 
+    private PropertyBuilder<String> getMembersPropertyBuilder(Tree groupTree) {
+        // FIXME: remove usage of MemoryPropertyBuilder (OAK-372)
+        PropertyState property = groupTree.getProperty(REP_MEMBERS);
+        if (property == null) {
+            return MemoryPropertyBuilder.array(WEAKREFERENCE, REP_MEMBERS);
+        } else {
+            return MemoryPropertyBuilder.copy(WEAKREFERENCE, property);
+        }
+    }
+
     private boolean useMemberNode(Tree groupTree) {
         return splitSize >= 4 && !groupTree.hasProperty(REP_MEMBERS);
     }



Mime
View raw message