Package org.apache.sling.jackrabbit.usermanager.impl.post

# Class AbstractAuthorizablePostServlet

java.lang.Object
jakarta.servlet.GenericServlet
org.apache.sling.api.servlets.SlingJakartaSafeMethodsServlet
org.apache.sling.api.servlets.SlingJakartaAllMethodsServlet
org.apache.sling.jackrabbit.usermanager.impl.post.AbstractPostServlet
org.apache.sling.jackrabbit.usermanager.impl.post.AbstractAuthorizablePostServlet

All Implemented Interfaces:
  `jakarta.servlet.Servlet`, `jakarta.servlet.ServletConfig`, `Serializable`

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 PrincipalNameFilter`
`principalNameFilter`
The optional principal name filter
`protected LinkedList<org.apache.sling.jackrabbit.usermanager.impl.post.AbstractAuthorizablePostServlet.PrincipalNameGeneratorHolder>`
`principalNameGenerators`
The principal name generators
`static final String`
`PROP_DATE_FORMAT`
`protected static final String`
`RP_NODE_NAME_HINT_VALUE_FROM`
`protected static final String`
`RP_NODE_NAME_VALUE_FROM`
`protected SystemUserManagerPaths`
`systemUserManagerPaths`

## Constructor Summary

Constructors
Constructor
Description
`AbstractAuthorizablePostServlet()`

## Method Summary

Modifier and Type
Method
Description
`protected void`
`activate(Map<String,Object> props)`
`protected void`
`bindPrincipalNameFilter(PrincipalNameFilter filter)`
Bind a new principal name filter
`protected void`
`bindPrincipalNameGenerator(PrincipalNameGenerator generator, Map<String,Object> properties)`
Bind a new principal name generator
`protected void`
`bindSystemUserManagerPaths(SystemUserManagerPaths sump)`
`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.
`protected String`
`concatPath(@NotNull String parentPath, @NotNull String other)`
Helper utility to join a path with a descandant subpath
`protected @NotNull org.apache.sling.api.request.RequestParameter[]`
`convertToRequestParameterArray(String paramName, Object obj)`
`protected String`
`convertToString(Object obj)`
`protected @NotNull String[]`
`convertToStringArray(Object obj)`
`protected void`
`deactivate()`
`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 created
`protected boolean`
`hasItemPathPrefix(String name)`
`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)`
Create resource(s) according to current request
`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)`
Removes all properties listed as `RequestProperty.isDelete()` from the authorizable.
`protected final boolean`
`requireItemPathPrefix(Map<String,?> properties)`
`protected void`
`unbindPrincipalNameFilter(PrincipalNameFilter filter)`
`protected void`
`unbindPrincipalNameGenerator(PrincipalNameGenerator generator)`
`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)`
Writes back the content

### Methods inherited from class org.apache.sling.jackrabbit.usermanager.impl.post.AbstractPostServlet

`bindPostResponseCreator, doPost, externalizePath, getItemPath, getRanking, getRedirectUrl, handleOperation, isSetStatus, unbindPostResponseCreator`

### Methods inherited from class org.apache.sling.api.servlets.SlingJakartaAllMethodsServlet

`doDelete, doPut, getAllowedRequestMethods, isMethodValid, mayService`

### Methods inherited from class org.apache.sling.api.servlets.SlingJakartaSafeMethodsServlet

`doGeneric, doGet, doHead, doOptions, doTrace, getServletInfo, handleMethodNotImplemented, service, service`

### Methods inherited from class jakarta.servlet.GenericServlet

`destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletName, init, init, log, log`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### 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

## Constructor Details

### AbstractAuthorizablePostServlet

public AbstractAuthorizablePostServlet()

## Method Details

### 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:
  `jcrSession` - the JCR session
  `properties` - the properties to consider when generating a name
  `type` - the type of authorizable
Returns:
  the principal name
Throws:
  `javax.jcr.RepositoryException`

### activate

protected void activate(Map<String,Object> props)

### deactivate

protected void deactivate()

### 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 the `RequestProperty`s
Returns:
  the list of `RequestProperty`s

### 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.RepositoryException
Removes all properties listed as `RequestProperty.isDelete()` from the authorizable.

Parameters:
  `authorizable` - The `org.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` - The `List` to be updated with information on deleted properties.
Throws:
  `javax.jcr.RepositoryException` - Is thrown if an error occurrs checking or removing properties.

### concatPath

protected String concatPath(@NotNull @NotNull String parentPath, @NotNull @NotNull String other)
Helper utility to join a path with a descandant subpath

Parameters:
  `parentPath` - the parent path
  `other` - 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,org.apache.sling.servlets.post.impl.helper.RequestProperty> reqProperties, List<org.apache.sling.servlets.post.Modification> changes) throws javax.jcr.RepositoryException
Create resource(s) according to current request

Parameters:
  `session` - the sessioin to write the authorizable properties
  `authorizable` - The `org.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` - The `List` 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<org.apache.sling.servlets.post.impl.helper.RequestProperty> reqProperties, List<org.apache.sling.servlets.post.Modification> changes) throws javax.jcr.RepositoryException
Writes back the content

Parameters:
  `session` - the sessioin to write the authorizable properties
  `authorizable` - the authorizable to modify
  `reqProperties` - the properties to write
  `changes` - 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:
  `true` if the `name` starts with either of the prefixes `SlingPostConstants.ITEM_PREFIX_RELATIVE_CURRENT`, `SlingPostConstants.ITEM_PREFIX_RELATIVE_PARENT` and `SlingPostConstants.ITEM_PREFIX_ABSOLUTE`

### requireItemPathPrefix

protected final boolean requireItemPathPrefix(Map<String,?> properties)

Parameters:
  `properties` - the request parameters
Returns:
  `true` if any of the request parameters starts with `SlingPostConstants.ITEM_PREFIX_RELATIVE_CURRENT`. In this case only parameters starting with either of the prefixes `SlingPostConstants.ITEM_PREFIX_RELATIVE_CURRENT`, `SlingPostConstants.ITEM_PREFIX_RELATIVE_PARENT` and `SlingPostConstants.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

protected String convertToString(Object obj)

### convertToStringArray

@NotNull protected @NotNull String[] convertToStringArray(Object obj)

### convertToRequestParameterArray

@NotNull protected @NotNull org.apache.sling.api.request.RequestParameter[] convertToRequestParameterArray(String paramName, Object obj)