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
public abstract class AbstractAuthorizablePostServlet extends AbstractPostServlet
Base class for all the POST servlets for the UserManager operations- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected PrincipalNameFilterprincipalNameFilterThe optional principal name filterprotected LinkedList<org.apache.sling.jackrabbit.usermanager.impl.post.AbstractAuthorizablePostServlet.PrincipalNameGeneratorHolder>principalNameGeneratorsThe principal name generatorsstatic StringPROP_DATE_FORMATprotected static StringRP_NODE_NAME_HINT_VALUE_FROMprotected static StringRP_NODE_NAME_VALUE_FROMprotected SystemUserManagerPathssystemUserManagerPaths
-
Constructor Summary
Constructors Constructor Description AbstractAuthorizablePostServlet()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected voidactivate(Map<String,Object> props)protected voidbindPrincipalNameFilter(PrincipalNameFilter filter)Bind a new principal name filterprotected voidbindPrincipalNameGenerator(PrincipalNameGenerator generator, Map<String,Object> properties)Bind a new principal name generatorprotected voidbindSystemUserManagerPaths(SystemUserManagerPaths sump)protected Collection<org.apache.sling.servlets.post.impl.helper.RequestProperty>collectContent(Map<String,?> properties)Deprecated.usecollectContentMap(Map)instead since 2.2.18protected Map<String,org.apache.sling.servlets.post.impl.helper.RequestProperty>collectContentMap(Map<String,?> properties)Collects the properties that form the content to be written back to the repository.protected @NotNull org.apache.sling.api.request.RequestParameter[]convertToRequestParameterArray(Object obj)protected StringconvertToString(Object obj)protected @NotNull String[]convertToStringArray(Object obj)protected voiddeactivate()protected 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,org.apache.sling.servlets.post.impl.helper.RequestProperty> reqProperties, List<org.apache.sling.servlets.post.Modification> changes)Create resource(s) according to current requestprotected voidprocessDeletes(org.apache.jackrabbit.api.security.user.Authorizable authorizable, Collection<org.apache.sling.servlets.post.impl.helper.RequestProperty> reqProperties, List<org.apache.sling.servlets.post.Modification> changes)Removes all properties listed asRequestProperty.isDelete()from the authorizable.protected booleanrequireItemPathPrefix(Map<String,?> properties)protected voidunbindPrincipalNameFilter(PrincipalNameFilter filter)protected voidunbindPrincipalNameGenerator(PrincipalNameGenerator generator)protected voidwriteContent(javax.jcr.Session session, org.apache.jackrabbit.api.security.user.Authorizable authorizable, Collection<org.apache.sling.servlets.post.impl.helper.RequestProperty> reqProperties, List<org.apache.sling.servlets.post.Modification> changes)Writes back the content-
Methods 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
-
-
-
-
Field Detail
-
RP_NODE_NAME_VALUE_FROM
protected static final String RP_NODE_NAME_VALUE_FROM
-
RP_NODE_NAME_HINT_VALUE_FROM
protected static final String RP_NODE_NAME_HINT_VALUE_FROM
-
PROP_DATE_FORMAT
public static final String PROP_DATE_FORMAT
- See Also:
- Constant Field Values
-
systemUserManagerPaths
protected transient SystemUserManagerPaths systemUserManagerPaths
-
principalNameGenerators
protected transient LinkedList<org.apache.sling.jackrabbit.usermanager.impl.post.AbstractAuthorizablePostServlet.PrincipalNameGeneratorHolder> principalNameGenerators
The principal name generators
-
principalNameFilter
protected transient PrincipalNameFilter principalNameFilter
The optional principal name filter
-
-
Method Detail
-
bindSystemUserManagerPaths
protected void bindSystemUserManagerPaths(SystemUserManagerPaths sump)
-
bindPrincipalNameGenerator
protected void bindPrincipalNameGenerator(PrincipalNameGenerator generator, Map<String,Object> properties)
Bind a new principal name generator
-
unbindPrincipalNameGenerator
protected void unbindPrincipalNameGenerator(PrincipalNameGenerator generator)
-
bindPrincipalNameFilter
protected void bindPrincipalNameFilter(PrincipalNameFilter filter)
Bind a new principal name filter
-
unbindPrincipalNameFilter
protected void unbindPrincipalNameFilter(PrincipalNameFilter filter)
-
getOrGeneratePrincipalName
protected String getOrGeneratePrincipalName(javax.jcr.Session jcrSession, Map<String,?> properties, org.apache.jackrabbit.oak.spi.security.user.AuthorizableType type) throws javax.jcr.RepositoryException
Get or generate the name of the principal being created- Parameters:
request- the current request- Returns:
- the principal name
- Throws:
javax.jcr.RepositoryException
-
deactivate
protected void deactivate()
-
collectContent
@Deprecated protected Collection<org.apache.sling.servlets.post.impl.helper.RequestProperty> collectContent(Map<String,?> properties)
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
protected Map<String,org.apache.sling.servlets.post.impl.helper.RequestProperty> collectContentMap(Map<String,?> properties)
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<org.apache.sling.servlets.post.impl.helper.RequestProperty> reqProperties, List<org.apache.sling.servlets.post.Modification> changes) throws javax.jcr.RepositoryExceptionRemoves 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.
-
processCreate
protected void processCreate(javax.jcr.Session session, org.apache.jackrabbit.api.security.user.Authorizable authorizable, Map<String,org.apache.sling.servlets.post.impl.helper.RequestProperty> reqProperties, List<org.apache.sling.servlets.post.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<org.apache.sling.servlets.post.impl.helper.RequestProperty> reqProperties, List<org.apache.sling.servlets.post.Modification> changes) throws javax.jcr.RepositoryExceptionWrites 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
protected boolean hasItemPathPrefix(String name)
- 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
protected final boolean requireItemPathPrefix(Map<String,?> properties)
- 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.
-
convertToRequestParameterArray
@NotNull protected @NotNull org.apache.sling.api.request.RequestParameter[] convertToRequestParameterArray(Object obj)
-
-