Class UpdateUserServlet
- java.lang.Object
-
- javax.servlet.GenericServlet
-
- org.apache.sling.api.servlets.SlingSafeMethodsServlet
-
- org.apache.sling.api.servlets.SlingAllMethodsServlet
-
- org.apache.sling.jackrabbit.usermanager.impl.post.AbstractPostServlet
-
- org.apache.sling.jackrabbit.usermanager.impl.post.AbstractAuthorizablePostServlet
-
- org.apache.sling.jackrabbit.usermanager.impl.post.UpdateUserServlet
-
- All Implemented Interfaces:
Serializable
,javax.servlet.Servlet
,javax.servlet.ServletConfig
,UpdateUser
public class UpdateUserServlet extends AbstractAuthorizablePostServlet implements UpdateUser
Sling Post Operation implementation for updating a user in the jackrabbit UserManager.
Rest Service Description
Updates a users properties. Maps on to nodes of resourceType
sling/users
like/rep:system/rep:userManager/rep:users
mapped to a resource url/system/userManager/user/ieb
. This servlet responds at/system/userManager/user/ieb.update.html
Methods
- POST
Post Parameters
- *
- Any additional parameters become properties of the user node (optional)
- *@Delete
- Delete the property eg prop3@Delete means prop3 will be deleted (optional)
Response
- 200
- Success, a redirect is sent to the users resource locator. The redirect comes with HTML describing the status.
- 404
- The resource was not found
- 500
- Failure
Example
curl -Fprop1=value2 -Fproperty1=value1 http://localhost:8080/system/userManager/user/ieb.update.html
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.apache.sling.jackrabbit.usermanager.impl.post.AbstractAuthorizablePostServlet
principalNameFilter, principalNameGenerators, PROP_DATE_FORMAT, RP_NODE_NAME_HINT_VALUE_FROM, RP_NODE_NAME_VALUE_FROM, systemUserManagerPaths
-
-
Constructor Summary
Constructors Constructor Description UpdateUserServlet()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
activate(Map<String,Object> props)
protected void
bindPostResponseCreator(org.apache.sling.servlets.post.PostResponseCreator creator, Map<String,Object> properties)
Overridden since the @Reference annotation is not inherited from the super methodprotected void
bindSystemUserManagerPaths(SystemUserManagerPaths sump)
protected void
deactivate()
protected void
handleOperation(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.servlets.post.PostResponse response, List<org.apache.sling.servlets.post.Modification> changes)
Extending Servlet should implement this operation to do the workprotected void
unbindPostResponseCreator(org.apache.sling.servlets.post.PostResponseCreator creator, Map<String,Object> properties)
Unbind a post response creatororg.apache.jackrabbit.api.security.user.User
updateUser(javax.jcr.Session jcrSession, String name, Map<String,?> properties, List<org.apache.sling.servlets.post.Modification> changes)
Update a user in the repository-
Methods inherited from class org.apache.sling.jackrabbit.usermanager.impl.post.AbstractAuthorizablePostServlet
bindPrincipalNameFilter, bindPrincipalNameGenerator, collectContent, collectContentMap, convertToRequestParameterArray, convertToString, convertToStringArray, getOrGeneratePrincipalName, hasItemPathPrefix, processCreate, processDeletes, requireItemPathPrefix, unbindPrincipalNameFilter, unbindPrincipalNameGenerator, writeContent
-
Methods inherited from class org.apache.sling.jackrabbit.usermanager.impl.post.AbstractPostServlet
createHtmlResponse, doPost, externalizePath, getItemPath, getRanking, getRedirectUrl, getRedirectUrl, handleOperation, isSetStatus
-
Methods inherited from class org.apache.sling.api.servlets.SlingAllMethodsServlet
doDelete, doPut, getAllowedRequestMethods, isMethodValid, mayService
-
Methods inherited from class org.apache.sling.api.servlets.SlingSafeMethodsServlet
doGeneric, doGet, doHead, doOptions, doTrace, getServletInfo, handleMethodNotImplemented, service, service
-
-
-
-
Method Detail
-
activate
protected void activate(Map<String,Object> props)
- Overrides:
activate
in classAbstractAuthorizablePostServlet
-
deactivate
protected void deactivate()
- Overrides:
deactivate
in classAbstractAuthorizablePostServlet
-
bindSystemUserManagerPaths
protected void bindSystemUserManagerPaths(SystemUserManagerPaths sump)
- Overrides:
bindSystemUserManagerPaths
in classAbstractAuthorizablePostServlet
-
bindPostResponseCreator
protected void bindPostResponseCreator(org.apache.sling.servlets.post.PostResponseCreator creator, Map<String,Object> properties)
Overridden since the @Reference annotation is not inherited from the super method
-
unbindPostResponseCreator
protected void unbindPostResponseCreator(org.apache.sling.servlets.post.PostResponseCreator creator, Map<String,Object> properties)
Description copied from class:AbstractPostServlet
Unbind a post response creator- Overrides:
unbindPostResponseCreator
in classAbstractPostServlet
-
handleOperation
protected void handleOperation(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.servlets.post.PostResponse response, List<org.apache.sling.servlets.post.Modification> changes) throws javax.jcr.RepositoryException
Description copied from class:AbstractPostServlet
Extending Servlet should implement this operation to do the work- Specified by:
handleOperation
in classAbstractPostServlet
- Parameters:
request
- the sling http request to processresponse
- the responsechanges
- the changes to report- Throws:
javax.jcr.RepositoryException
- in case of exceptions during the operation
-
updateUser
public org.apache.jackrabbit.api.security.user.User updateUser(javax.jcr.Session jcrSession, String name, Map<String,?> properties, List<org.apache.sling.servlets.post.Modification> changes) throws javax.jcr.RepositoryException
Description copied from interface:UpdateUser
Update a user in the repository- Specified by:
updateUser
in interfaceUpdateUser
- Parameters:
jcrSession
- the JCR session of the user updating the username
- The name of the user to update (required)properties
- Extra properties to update on the user. The entry values should be either a String or String[] (optional)changes
- The list of changes for this operation (optional)- Returns:
- the user that was updated or null if not found
- Throws:
javax.jcr.RepositoryException
- if user can't be updated
-
-