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
Modifier and TypeFieldDescriptionprotected PrincipalNameFilter
The optional principal name filterprotected LinkedList<org.apache.sling.jackrabbit.usermanager.impl.post.AbstractAuthorizablePostServlet.PrincipalNameGeneratorHolder>
The principal name generatorsstatic final String
protected static final String
protected static final String
protected SystemUserManagerPaths
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
protected void
Bind a new principal name filterprotected void
bindPrincipalNameGenerator
(PrincipalNameGenerator generator, Map<String, Object> properties) Bind a new principal name generatorprotected void
protected 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 String
concatPath
(@NotNull String parentPath, @NotNull String other) Helper utility to join a path with a descandant subpathprotected @NotNull RequestParameter[]
protected String
convertToString
(Object obj) protected @NotNull String[]
protected void
protected String
getOrGeneratePrincipalName
(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 boolean
hasItemPathPrefix
(String name) protected void
processCreate
(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 void
processDeletes
(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 boolean
requireItemPathPrefix
(Map<String, ?> properties) protected void
protected void
protected void
writeContent
(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, unbindPostResponseCreator
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
Methods 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 theRequestProperty
s- Returns:
- the list of
RequestProperty
s
-
collectContentMap
Collects the properties that form the content to be written back to the repository.- Parameters:
properties
- the properties out of which to generate theRequestProperty
s- Returns:
- the list of
RequestProperty
s
-
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.Authorizable
that should have properties deleted.reqProperties
- The collection of request properties to check for properties to be removed.changes
- TheList
to 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.Authorizable
that should have properties deleted.reqProperties
- The collection of request properties to check for properties to be removed.changes
- TheList
to 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:
true
if thename
starts with either of the prefixesSlingPostConstants.ITEM_PREFIX_RELATIVE_CURRENT
,SlingPostConstants.ITEM_PREFIX_RELATIVE_PARENT
andSlingPostConstants.ITEM_PREFIX_ABSOLUTE
-
requireItemPathPrefix
- Parameters:
properties
- the request parameters- Returns:
true
if 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_PARENT
andSlingPostConstants.ITEM_PREFIX_ABSOLUTE
are 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