Class AbstractAuthorizablePostServlet
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
- All Implemented Interfaces:
Serializable,javax.servlet.Servlet,javax.servlet.ServletConfig
- Direct Known Subclasses:
AbstractGroupPostServlet,ChangeUserPasswordServlet,CreateUserServlet,UpdateUserServlet
Base class for all the POST servlets for the UserManager operations
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected PrincipalNameFilterThe optional principal name filterprotected LinkedList<org.apache.sling.jackrabbit.usermanager.impl.post.AbstractAuthorizablePostServlet.PrincipalNameGeneratorHolder>The principal name generatorsstatic final Stringprotected static final Stringprotected static final Stringprotected SystemUserManagerPaths -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected voidBind a new principal name filterprotected voidbindPrincipalNameGenerator(PrincipalNameGenerator generator, Map<String, Object> properties) Bind a new principal name generatorprotected voidprotected Collection<RequestProperty>collectContent(Map<String, ?> properties) Deprecated.protected Map<String,RequestProperty> collectContentMap(Map<String, ?> properties) Collects the properties that form the content to be written back to the repository.protected StringconcatPath(@NotNull String parentPath, @NotNull String other) Helper utility to join a path with a descandant subpathprotected @NotNull RequestParameter[]protected StringconvertToString(Object obj) protected @NotNull String[]protected voidprotected StringgetOrGeneratePrincipalName(javax.jcr.Session jcrSession, Map<String, ?> properties, org.apache.jackrabbit.oak.spi.security.user.AuthorizableType type) Get or generate the name of the principal being createdprotected booleanhasItemPathPrefix(String name) protected voidprocessCreate(javax.jcr.Session session, org.apache.jackrabbit.api.security.user.Authorizable authorizable, Map<String, RequestProperty> reqProperties, List<Modification> changes) Create resource(s) according to current requestprotected voidprocessDeletes(org.apache.jackrabbit.api.security.user.Authorizable authorizable, Collection<RequestProperty> reqProperties, List<Modification> changes) Removes all properties listed asRequestProperty.isDelete()from the authorizable.protected final booleanrequireItemPathPrefix(Map<String, ?> properties) protected voidprotected voidprotected voidwriteContent(javax.jcr.Session session, org.apache.jackrabbit.api.security.user.Authorizable authorizable, Collection<RequestProperty> reqProperties, List<Modification> changes) Writes back the contentMethods inherited from class org.apache.sling.jackrabbit.usermanager.impl.post.AbstractPostServlet
bindPostResponseCreator, createHtmlResponse, doPost, externalizePath, getItemPath, getRanking, getRedirectUrl, getRedirectUrl, handleOperation, handleOperation, isSetStatus, unbindPostResponseCreatorMethods inherited from class org.apache.sling.api.servlets.SlingAllMethodsServlet
doDelete, doPut, getAllowedRequestMethods, isMethodValid, mayServiceMethods inherited from class org.apache.sling.api.servlets.SlingSafeMethodsServlet
doGeneric, doGet, doHead, doOptions, doTrace, getServletInfo, handleMethodNotImplemented, service, serviceMethods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletName, init, init, log, log
-
Field Details
-
RP_NODE_NAME_VALUE_FROM
-
RP_NODE_NAME_HINT_VALUE_FROM
-
PROP_DATE_FORMAT
- See Also:
-
systemUserManagerPaths
-
principalNameGenerators
protected transient LinkedList<org.apache.sling.jackrabbit.usermanager.impl.post.AbstractAuthorizablePostServlet.PrincipalNameGeneratorHolder> principalNameGeneratorsThe principal name generators -
principalNameFilter
The optional principal name filter
-
-
Constructor Details
-
AbstractAuthorizablePostServlet
public AbstractAuthorizablePostServlet()
-
-
Method Details
-
bindSystemUserManagerPaths
-
bindPrincipalNameGenerator
protected void bindPrincipalNameGenerator(PrincipalNameGenerator generator, Map<String, Object> properties) Bind a new principal name generator -
unbindPrincipalNameGenerator
-
bindPrincipalNameFilter
Bind a new principal name filter -
unbindPrincipalNameFilter
-
getOrGeneratePrincipalName
protected String getOrGeneratePrincipalName(javax.jcr.Session jcrSession, Map<String, ?> properties, org.apache.jackrabbit.oak.spi.security.user.AuthorizableType type) throws javax.jcr.RepositoryExceptionGet or generate the name of the principal being created- Parameters:
jcrSession- the JCR sessionproperties- the properties to consider when generating a nametype- the type of authorizable- Returns:
- the principal name
- Throws:
javax.jcr.RepositoryException
-
activate
-
deactivate
protected void deactivate() -
collectContent
Deprecated.usecollectContentMap(Map)instead since 2.2.18Collects the properties that form the content to be written back to the repository.- Parameters:
properties- the properties out of which to generate theRequestPropertys- Returns:
- the list of
RequestPropertys
-
collectContentMap
Collects the properties that form the content to be written back to the repository.- Parameters:
properties- the properties out of which to generate theRequestPropertys- Returns:
- the list of
RequestPropertys
-
processDeletes
protected void processDeletes(org.apache.jackrabbit.api.security.user.Authorizable authorizable, Collection<RequestProperty> reqProperties, List<Modification> changes) throws javax.jcr.RepositoryException Removes all properties listed asRequestProperty.isDelete()from the authorizable.- Parameters:
authorizable- Theorg.apache.jackrabbit.api.security.user.Authorizablethat should have properties deleted.reqProperties- The collection of request properties to check for properties to be removed.changes- TheListto be updated with information on deleted properties.- Throws:
javax.jcr.RepositoryException- Is thrown if an error occurrs checking or removing properties.
-
concatPath
Helper utility to join a path with a descandant subpath- Parameters:
parentPath- the parent pathother- the descendant path- Returns:
- the joined path
-
processCreate
protected void processCreate(javax.jcr.Session session, org.apache.jackrabbit.api.security.user.Authorizable authorizable, Map<String, RequestProperty> reqProperties, List<Modification> changes) throws javax.jcr.RepositoryExceptionCreate resource(s) according to current request- Parameters:
session- the sessioin to write the authorizable propertiesauthorizable- Theorg.apache.jackrabbit.api.security.user.Authorizablethat should have properties deleted.reqProperties- The collection of request properties to check for properties to be removed.changes- TheListto be updated with information on deleted properties.- Throws:
javax.jcr.RepositoryException- Is thrown if an error occurrs checking or removing properties.
-
writeContent
protected void writeContent(javax.jcr.Session session, org.apache.jackrabbit.api.security.user.Authorizable authorizable, Collection<RequestProperty> reqProperties, List<Modification> changes) throws javax.jcr.RepositoryException Writes back the content- Parameters:
session- the sessioin to write the authorizable propertiesauthorizable- the authorizable to modifyreqProperties- the properties to writechanges- the list of changes which is supposed to be extended- Throws:
javax.jcr.RepositoryException- if a repository error occurs
-
hasItemPathPrefix
- Parameters:
name- the name- Returns:
trueif thenamestarts with either of the prefixesSlingPostConstants.ITEM_PREFIX_RELATIVE_CURRENT,SlingPostConstants.ITEM_PREFIX_RELATIVE_PARENTandSlingPostConstants.ITEM_PREFIX_ABSOLUTE
-
requireItemPathPrefix
- Parameters:
properties- the request parameters- Returns:
trueif any of the request parameters starts withSlingPostConstants.ITEM_PREFIX_RELATIVE_CURRENT. In this case only parameters starting with either of the prefixesSlingPostConstants.ITEM_PREFIX_RELATIVE_CURRENT,SlingPostConstants.ITEM_PREFIX_RELATIVE_PARENTandSlingPostConstants.ITEM_PREFIX_ABSOLUTEare considered as providing content to be stored. Otherwise all parameters not starting with the command prefix:are considered as parameters to be stored.
-
convertToString
-
convertToStringArray
-
convertToRequestParameterArray
-
collectContentMap(Map)instead since 2.2.18