jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1431501 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak: security/user/AuthorizablePropertiesImpl.java spi/security/user/util/UserUtility.java
Date Thu, 10 Jan 2013 17:02:38 GMT
Author: angela
Date: Thu Jan 10 17:02:37 2013
New Revision: 1431501

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

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/AuthorizablePropertiesImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/util/UserUtility.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/AuthorizablePropertiesImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/AuthorizablePropertiesImpl.java?rev=1431501&r1=1431500&r2=1431501&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/AuthorizablePropertiesImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/AuthorizablePropertiesImpl.java
Thu Jan 10 17:02:37 2013
@@ -182,12 +182,9 @@ class AuthorizablePropertiesImpl impleme
 
         Tree node = getTree();
         TreeLocation propertyLocation = node.getLocation().getChild(relPath);
-        PropertyState property = propertyLocation.getProperty();
-        if (property != null) {
+        if (propertyLocation.getProperty() != null) {
             if (isAuthorizableProperty(node, propertyLocation, true)) {
-                Tree parent = propertyLocation.getParent().getTree();
-                parent.removeProperty(property.getName());
-                return true;
+                return propertyLocation.remove();
             } else {
                 throw new ConstraintViolationException("Property " + relPath + " isn't a
modifiable authorizable property");
             }
@@ -252,6 +249,10 @@ class AuthorizablePropertiesImpl impleme
         PropertyState property = propertyLocation.getProperty();
         if (property != null) {
             Tree parent = propertyLocation.getParent().getTree();
+            if (parent == null) {
+                log.debug("Unable to determine definition of authorizable property at " +
propertyLocation.getPath());
+                return null;
+            }
             PropertyDefinition def = nodeTypeManager.getDefinition(parent, property);
             if (def.isProtected() || (authorizablePath.equals(parent.getPath())
                     && !def.getDeclaringNodeType().isNodeType(UserConstants.NT_REP_AUTHORIZABLE)))
{

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/util/UserUtility.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/util/UserUtility.java?rev=1431501&r1=1431500&r2=1431501&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/util/UserUtility.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/util/UserUtility.java
Thu Jan 10 17:02:37 2013
@@ -19,7 +19,6 @@ package org.apache.jackrabbit.oak.spi.se
 import javax.annotation.CheckForNull;
 import javax.annotation.Nonnull;
 
-import org.apache.jackrabbit.JcrConstants;
 import org.apache.jackrabbit.oak.api.Tree;
 import org.apache.jackrabbit.oak.spi.security.ConfigurationParameters;
 import org.apache.jackrabbit.oak.spi.security.user.AuthorizableType;
@@ -27,8 +26,6 @@ import org.apache.jackrabbit.oak.spi.sec
 import org.apache.jackrabbit.oak.util.NodeUtil;
 import org.apache.jackrabbit.util.Text;
 
-import static org.apache.jackrabbit.oak.api.Type.STRING;
-
 /**
  * UserUtils... TODO
  */
@@ -48,8 +45,8 @@ public final class UserUtility implement
 
     public static boolean isType(Tree authorizableTree, AuthorizableType type) {
         // FIXME: check for node type according to the specified type constraint
-        if (authorizableTree != null && authorizableTree.hasProperty(JcrConstants.JCR_PRIMARYTYPE))
{
-            String ntName = authorizableTree.getProperty(JcrConstants.JCR_PRIMARYTYPE).getValue(STRING);
+        if (authorizableTree != null) {
+            String ntName = new NodeUtil(authorizableTree).getPrimaryNodeTypeName();
             switch (type) {
                 case GROUP:
                     return NT_REP_GROUP.equals(ntName);



Mime
View raw message