Guest User

Untitled

a guest
May 19th, 2012
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Index: src/main/java/org/apache/sling/jackrabbit/usermanager/impl/post/CreateUserServlet.java
  2. ===================================================================
  3. --- src/main/java/org/apache/sling/jackrabbit/usermanager/impl/post/CreateUserServlet.java  (revision 1340341)
  4. +++ src/main/java/org/apache/sling/jackrabbit/usermanager/impl/post/CreateUserServlet.java  (working copy)
  5. @@ -41,6 +41,7 @@
  6.  import org.apache.sling.jcr.api.SlingRepository;
  7.  import org.apache.sling.jcr.base.util.AccessControlUtil;
  8.  import org.apache.sling.servlets.post.Modification;
  9. +import org.apache.sling.servlets.post.ModificationType;
  10.  import org.apache.sling.servlets.post.SlingPostConstants;
  11.  import org.apache.sling.servlets.post.impl.helper.RequestProperty;
  12.  import org.osgi.service.component.ComponentContext;
  13. @@ -207,10 +208,23 @@
  14.                              request.getRequestParameterMap(),
  15.                              changes);
  16.          
  17. -        String userPath = AuthorizableResourceProvider.SYSTEM_USER_MANAGER_USER_PREFIX
  18. -                + user.getID();
  19. -        response.setPath(userPath);
  20. -        response.setLocation(externalizePath(request, userPath));
  21. +        String userPath = null;
  22. +        if (user == null) {
  23. +           if (changes.size() > 0) {
  24. +               Modification modification = changes.get(0);
  25. +               if (modification.getType() == ModificationType.CREATE) {
  26. +                   userPath = modification.getSource();
  27. +               }
  28. +           }
  29. +        } else {
  30. +           userPath = AuthorizableResourceProvider.SYSTEM_USER_MANAGER_USER_PREFIX
  31. +                    + user.getID();
  32. +        }
  33. +        
  34. +        if (userPath != null) {
  35. +            response.setPath(userPath);
  36. +            response.setLocation(externalizePath(request, userPath));
  37. +        }
  38.          response.setParentLocation(externalizePath(request,
  39.              AuthorizableResourceProvider.SYSTEM_USER_MANAGER_USER_PATH));
  40.      }
Advertisement
Add Comment
Please, Sign In to add comment