incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thecarlh...@apache.org
Subject svn commit: r1347825 - /sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/impl/post/CreateUserServlet.java
Date Thu, 07 Jun 2012 23:04:43 GMT
Author: thecarlhall
Date: Thu Jun  7 23:04:43 2012
New Revision: 1347825

URL: http://svn.apache.org/viewvc?rev=1347825&view=rev
Log:
SLING-2465 Applied patch from Eric to set user path when creating a user that the creator
can't 'see'

Modified:
    sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/impl/post/CreateUserServlet.java

Modified: sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/impl/post/CreateUserServlet.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/impl/post/CreateUserServlet.java?rev=1347825&r1=1347824&r2=1347825&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/impl/post/CreateUserServlet.java
(original)
+++ sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/impl/post/CreateUserServlet.java
Thu Jun  7 23:04:43 2012
@@ -41,6 +41,7 @@ import org.apache.sling.jackrabbit.userm
 import org.apache.sling.jcr.api.SlingRepository;
 import org.apache.sling.jcr.base.util.AccessControlUtil;
 import org.apache.sling.servlets.post.Modification;
+import org.apache.sling.servlets.post.ModificationType;
 import org.apache.sling.servlets.post.SlingPostConstants;
 import org.apache.sling.servlets.post.impl.helper.RequestProperty;
 import org.osgi.service.component.ComponentContext;
@@ -207,10 +208,23 @@ public class CreateUserServlet extends A
                             request.getRequestParameterMap(), 
                             changes);
         
-        String userPath = AuthorizableResourceProvider.SYSTEM_USER_MANAGER_USER_PREFIX
-                + user.getID();
-        response.setPath(userPath);
-        response.setLocation(externalizePath(request, userPath));
+        String userPath = null;
+        if (user == null) {
+            if (changes.size() > 0) {
+                Modification modification = changes.get(0);
+                if (modification.getType() == ModificationType.CREATE) {
+                    userPath = modification.getSource();
+                }
+            }
+        } else {
+            userPath = AuthorizableResourceProvider.SYSTEM_USER_MANAGER_USER_PREFIX
+                    + user.getID();
+        }
+        
+        if (userPath != null) {
+            response.setPath(userPath);
+            response.setLocation(externalizePath(request, userPath));
+        }
         response.setParentLocation(externalizePath(request,
             AuthorizableResourceProvider.SYSTEM_USER_MANAGER_USER_PATH));
     }



Mime
View raw message