Class ModifyAceServlet
- java.lang.Object
-
- javax.servlet.GenericServlet
-
- org.apache.sling.api.servlets.SlingSafeMethodsServlet
-
- org.apache.sling.api.servlets.SlingAllMethodsServlet
-
- org.apache.sling.jcr.jackrabbit.accessmanager.post.AbstractAccessPostServlet
-
- org.apache.sling.jcr.jackrabbit.accessmanager.post.ModifyAceServlet
-
- All Implemented Interfaces:
Serializable,javax.servlet.Servlet,javax.servlet.ServletConfig,ModifyAce
public class ModifyAceServlet extends AbstractAccessPostServlet implements ModifyAce
Sling Post Servlet implementation for modifying the ACEs for a principal on a JCR resource.
Rest Service Description
Modify a principal's ACEs for the node identified as a resource by the request URL >resource<.modifyAce.html
Transport Details:
Methods
- POST
Post Parameters
- principalId
- The principal of the ACEs to modify in the ACL specified by the path.
- privilege@*
- One or more privileges, either granted or denied or none, which will be applied to (or removed from) the node ACL. Any permissions that are present in an existing ACE for the principal but not in the request are left untouched.
- restriction@*
- One or more restrictions which will be applied to the ACE
- restriction@*@Delete
- One or more restrictions which will be removed from the ACE
Response
- 200
- Success.
- 404
- The resource was not found.
- 500
- Failure. HTML explains the failure.
Notes
The principalId is assumed to refer directly to an Authorizable, that comes direct from the UserManager. This can be a group or a user, but if its a group, denied permissions will not be added to the group. The group will only contain granted privileges.
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ModifyAceServlet()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidbindPostResponseCreator(org.apache.sling.servlets.post.PostResponseCreator creator, Map<String,Object> properties)Overridden since the @Reference annotation is not inherited from the super methodprotected voidbindRestrictionProvider(org.apache.jackrabbit.oak.spi.security.authorization.restriction.RestrictionProvider rp)protected voidhandleOperation(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 workvoidmodifyAce(javax.jcr.Session jcrSession, String resourcePath, String principalId, Map<String,String> privileges, String order)Add or modify the access control entry for the specified user or group.voidmodifyAce(javax.jcr.Session jcrSession, String resourcePath, String principalId, Map<String,String> privileges, String order, boolean autoSave)Add or modify the access control entry for the specified user or group.voidmodifyAce(javax.jcr.Session jcrSession, String resourcePath, String principalId, Map<String,String> privileges, String order, Map<String,javax.jcr.Value> restrictions, Map<String,javax.jcr.Value[]> mvRestrictions, Set<String> removeRestrictionNames)Add or modify the access control entry for the specified user or group.voidmodifyAce(javax.jcr.Session jcrSession, String resourcePath, String principalId, Map<String,String> privileges, String order, Map<String,javax.jcr.Value> restrictions, Map<String,javax.jcr.Value[]> mvRestrictions, Set<String> removeRestrictionNames, boolean autoSave)Add or modify the access control entry for the specified user or group.protected voidmodifyAce(javax.jcr.Session jcrSession, String resourcePath, String principalId, Map<String,String> privileges, String order, Map<String,javax.jcr.Value> restrictions, Map<String,javax.jcr.Value[]> mvRestrictions, Set<String> removeRestrictionNames, boolean autoSave, List<org.apache.sling.servlets.post.Modification> changes)protected voidunbindPostResponseCreator(org.apache.sling.servlets.post.PostResponseCreator creator, Map<String,Object> properties)Unbind a post response creatorprotected voidunbindRestrictionProvider(org.apache.jackrabbit.oak.spi.security.authorization.restriction.RestrictionProvider rp)-
Methods inherited from class org.apache.sling.jcr.jackrabbit.accessmanager.post.AbstractAccessPostServlet
createHtmlResponse, doPost, externalizePath, getAccessControlList, getAccessControlListOrNull, getItemPath, 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
-
bindRestrictionProvider
protected void bindRestrictionProvider(org.apache.jackrabbit.oak.spi.security.authorization.restriction.RestrictionProvider rp)
-
unbindRestrictionProvider
protected void unbindRestrictionProvider(org.apache.jackrabbit.oak.spi.security.authorization.restriction.RestrictionProvider rp)
-
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- Overrides:
bindPostResponseCreatorin classAbstractAccessPostServlet- Parameters:
creator- the response creator service referenceproperties- the component properties for the service reference
-
unbindPostResponseCreator
protected void unbindPostResponseCreator(org.apache.sling.servlets.post.PostResponseCreator creator, Map<String,Object> properties)Description copied from class:AbstractAccessPostServletUnbind a post response creator- Overrides:
unbindPostResponseCreatorin classAbstractAccessPostServlet- Parameters:
creator- the response creator service referenceproperties- the component properties for the service reference
-
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.RepositoryExceptionDescription copied from class:AbstractAccessPostServletExtending Servlet should implement this operation to do the work- Specified by:
handleOperationin classAbstractAccessPostServlet- Parameters:
request- the sling http request to processresponse- the responsechanges- the changes to report- Throws:
javax.jcr.RepositoryException- if any errors applying the changes
-
modifyAce
public void modifyAce(javax.jcr.Session jcrSession, String resourcePath, String principalId, Map<String,String> privileges, String order, boolean autoSave) throws javax.jcr.RepositoryExceptionDescription copied from interface:ModifyAceAdd or modify the access control entry for the specified user or group.- Specified by:
modifyAcein interfaceModifyAce- Parameters:
jcrSession- the JCR session of the user updating the userresourcePath- The absolute path of the resource to apply the ACE to (required)principalId- The name of the user/group to provision (required)privileges- Map of privileges to apply. (optional)order- where the access control entry should go in the list.The value should be one of these: null If the ACE for the principal doesn't exist add at the end, otherwise leave the ACE at it's current position. first Place the target ACE as the first amongst its siblings last Place the target ACE as the last amongst its siblings before xyz Place the target ACE immediately before the sibling whose name is xyz after xyz Place the target ACE immediately after the sibling whose name is xyz numeric Place the target ACE at the specified numeric index autoSave- true to automatically save changes to the JCR session, false otherwise- Throws:
javax.jcr.RepositoryException- if any errors applying the changes
-
modifyAce
public void modifyAce(javax.jcr.Session jcrSession, String resourcePath, String principalId, Map<String,String> privileges, String order) throws javax.jcr.RepositoryExceptionDescription copied from interface:ModifyAceAdd or modify the access control entry for the specified user or group. This is equivalent toModifyAce.modifyAce(Session, String, String, Map, String, boolean)with the autoSave parameter value equal to true.- Specified by:
modifyAcein interfaceModifyAce- Parameters:
jcrSession- the JCR session of the user updating the userresourcePath- The absolute path of the resource to apply the ACE to (required)principalId- The name of the user/group to provision (required)privileges- Map of privileges to apply. (optional)order- where the access control entry should go in the list.The value should be one of these: null If the ACE for the principal doesn't exist add at the end, otherwise leave the ACE at it's current position. first Place the target ACE as the first amongst its siblings last Place the target ACE as the last amongst its siblings before xyz Place the target ACE immediately before the sibling whose name is xyz after xyz Place the target ACE immediately after the sibling whose name is xyz numeric Place the target ACE at the specified numeric index - Throws:
javax.jcr.RepositoryException- if any errors applying the changes
-
modifyAce
public void modifyAce(javax.jcr.Session jcrSession, String resourcePath, String principalId, Map<String,String> privileges, String order, Map<String,javax.jcr.Value> restrictions, Map<String,javax.jcr.Value[]> mvRestrictions, Set<String> removeRestrictionNames) throws javax.jcr.RepositoryExceptionDescription copied from interface:ModifyAceAdd or modify the access control entry for the specified user or group. This is equivalent toModifyAce.modifyAce(Session, String, String, Map, String, Map, Map, Set, boolean)with the autoSave parameter value equal to true.- Specified by:
modifyAcein interfaceModifyAce- Parameters:
jcrSession- the JCR session of the user updating the userresourcePath- The absolute path of the resource to apply the ACE to (required)principalId- The name of the user/group to provision (required)privileges- Map of privileges to apply. (optional)order- where the access control entry should go in the list.The value should be one of these: null If the ACE for the principal doesn't exist add at the end, otherwise leave the ACE at it's current position. first Place the target ACE as the first amongst its siblings last Place the target ACE as the last amongst its siblings before xyz Place the target ACE immediately before the sibling whose name is xyz after xyz Place the target ACE immediately after the sibling whose name is xyz numeric Place the target ACE at the specified numeric index restrictions- Map of single-value restrictions to apply. (optional)mvRestrictions- Map of multi-value restrictions to apply. (optional)removeRestrictionNames- Set of existing restriction names to remove (optional)- Throws:
javax.jcr.RepositoryException- if any errors applying the changes
-
modifyAce
public void modifyAce(javax.jcr.Session jcrSession, String resourcePath, String principalId, Map<String,String> privileges, String order, Map<String,javax.jcr.Value> restrictions, Map<String,javax.jcr.Value[]> mvRestrictions, Set<String> removeRestrictionNames, boolean autoSave) throws javax.jcr.RepositoryExceptionDescription copied from interface:ModifyAceAdd or modify the access control entry for the specified user or group.- Specified by:
modifyAcein interfaceModifyAce- Parameters:
jcrSession- the JCR session of the user updating the userresourcePath- The absolute path of the resource to apply the ACE to (required)principalId- The name of the user/group to provision (required)privileges- Map of privileges to apply. (optional)order- where the access control entry should go in the list.The value should be one of these: null If the ACE for the principal doesn't exist add at the end, otherwise leave the ACE at it's current position. first Place the target ACE as the first amongst its siblings last Place the target ACE as the last amongst its siblings before xyz Place the target ACE immediately before the sibling whose name is xyz after xyz Place the target ACE immediately after the sibling whose name is xyz numeric Place the target ACE at the specified numeric index restrictions- Map of single-value restrictions to apply. (optional)mvRestrictions- Map of multi-value restrictions to apply. (optional)removeRestrictionNames- Set of existing restriction names to remove (optional)autoSave- true to automatically save changes to the JCR session, false otherwise- Throws:
javax.jcr.RepositoryException- if any errors applying the changes
-
modifyAce
protected void modifyAce(javax.jcr.Session jcrSession, String resourcePath, String principalId, Map<String,String> privileges, String order, Map<String,javax.jcr.Value> restrictions, Map<String,javax.jcr.Value[]> mvRestrictions, Set<String> removeRestrictionNames, boolean autoSave, List<org.apache.sling.servlets.post.Modification> changes) throws javax.jcr.RepositoryException- Throws:
javax.jcr.RepositoryException
-
-