jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1447201 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege: JcrAllCommitHook.java PrivilegeBits.java
Date Mon, 18 Feb 2013 11:18:23 GMT
Author: angela
Date: Mon Feb 18 11:18:22 2013
New Revision: 1447201

URL: http://svn.apache.org/r1447201
Log:
OAK-64: privilege mgt

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

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/JcrAllCommitHook.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/JcrAllCommitHook.java?rev=1447201&r1=1447200&r2=1447201&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/JcrAllCommitHook.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/JcrAllCommitHook.java
Mon Feb 18 11:18:22 2013
@@ -79,7 +79,7 @@ public class JcrAllCommitHook implements
                 if (after.getProperty(REP_AGGREGATES) == null) {
                     PrivilegeBits bits = PrivilegeBits.getInstance(after.getProperty(REP_BITS));
                     PrivilegeBits all = PrivilegeBits.getInstance(jcrAll.getProperty(REP_BITS));
-                    PrivilegeBits.getInstance(all).add(bits).writeTo(jcrAll, JCR_ALL);
+                    jcrAll.setProperty(PrivilegeBits.getInstance(all).add(bits).asPropertyState(REP_BITS));
                 }
             }
         }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeBits.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeBits.java?rev=1447201&r1=1447200&r2=1447201&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeBits.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeBits.java
Mon Feb 18 11:18:22 2013
@@ -19,7 +19,6 @@ package org.apache.jackrabbit.oak.securi
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Map;
-
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 
@@ -27,8 +26,8 @@ import com.google.common.primitives.Long
 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.plugins.memory.PropertyStates;
 import org.apache.jackrabbit.oak.spi.security.authorization.Permissions;
-import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
 
 import static com.google.common.base.Preconditions.checkArgument;
 
@@ -424,6 +423,11 @@ public final class PrivilegeBits impleme
         }
     }
 
+    @Nonnull
+    public PropertyState asPropertyState(String name) {
+        return PropertyStates.createProperty(name, Longs.asList(d.longValues()), Type.LONGS);
+    }
+
     /**
      * Package private method to calculate the privilege bits associated with a
      * given built-in or custom privilege definition.
@@ -446,18 +450,7 @@ public final class PrivilegeBits impleme
      */
     void writeTo(@Nonnull Tree tree) {
         String name = (REP_PRIVILEGES.equals(tree.getName())) ? REP_NEXT : REP_BITS;
-        tree.setProperty(name, Longs.asList(d.longValues()), Type.LONGS);
-    }
-
-    /**
-     * Write this instance as property to the specified node builder.
-     *
-     * @param nodeBuilder The target node builder.
-     * @param nodeName    The name of the node.
-     */
-    void writeTo(@Nonnull NodeBuilder nodeBuilder, @Nonnull String nodeName) {
-        String name = (REP_PRIVILEGES.equals(nodeName)) ? REP_NEXT : REP_BITS;
-        nodeBuilder.setProperty(name, Longs.asList(d.longValues()), Type.LONGS);
+        tree.setProperty(asPropertyState(name));
     }
 
     //-------------------------------------------------------------< Object >---



Mime
View raw message