You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 09:49:30 UTC

[sling-org-apache-sling-jcr-jackrabbit-usermanager] 11/33: SLING-2465 Applied patch from Eric to set user path when creating a user that the creator can't 'see'

This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.jcr.jackrabbit.usermanager-2.2.2
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-jackrabbit-usermanager.git

commit 08089b25e108c1af0bde209b3cb92b0ceab09886
Author: Carl Franklin Hall <th...@apache.org>
AuthorDate: Thu Jun 7 23:04:43 2012 +0000

    SLING-2465 Applied patch from Eric to set user path when creating a user that the creator can't 'see'
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/jcr/jackrabbit-usermanager@1347825 13f79535-47bb-0310-9956-ffa450edef68
---
 .../usermanager/impl/post/CreateUserServlet.java   | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/src/main/java/org/apache/sling/jackrabbit/usermanager/impl/post/CreateUserServlet.java b/src/main/java/org/apache/sling/jackrabbit/usermanager/impl/post/CreateUserServlet.java
index 638bcbd..df280ed 100644
--- a/src/main/java/org/apache/sling/jackrabbit/usermanager/impl/post/CreateUserServlet.java
+++ b/src/main/java/org/apache/sling/jackrabbit/usermanager/impl/post/CreateUserServlet.java
@@ -41,6 +41,7 @@ import org.apache.sling.jackrabbit.usermanager.impl.resource.AuthorizableResourc
 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 AbstractUserPostServlet implements Create
                             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));
     }

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.