Class GetPrincipalAceServlet

All Implemented Interfaces:
Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig, GetPrincipalAce

public class GetPrincipalAceServlet extends AbstractGetAceServlet implements GetPrincipalAce

Sling Get Servlet implementation for getting the principal based ACE for a principal on a JCR resource.

Rest Service Description

Get a principal's ACE for the node identified as a resource by the request URL >resource<.pace.json?pid=[principal_id]

Transport Details:

Methods

  • GET

Get Parameters

pid
The principal id of the ACE to get in the principal ACL specified by the path.

Response

200
Success.
404
The resource was not found or no access control entries exist for the principal.
500
Failure. JSON explains the failure.
See Also:
  • Constructor Details

    • GetPrincipalAceServlet

      public GetPrincipalAceServlet()
  • Method Details

    • getItemPath

      @Nullable protected @Nullable String getItemPath(SlingHttpServletRequest request)
      Description copied from class: AbstractAccessGetServlet
      Return the path where the action should be applied
      Overrides:
      getItemPath in class AbstractAccessGetServlet
    • validateResourcePath

      protected void validateResourcePath(javax.jcr.Session jcrSession, String resourcePath) throws javax.jcr.RepositoryException
      Description copied from class: AbstractAccessGetServlet
      Override if the path does not need to exist
      Overrides:
      validateResourcePath in class AbstractAccessGetServlet
      Throws:
      javax.jcr.RepositoryException
    • getPrincipalAce

      public jakarta.json.JsonObject getPrincipalAce(javax.jcr.Session jcrSession, String resourcePath, String principalId) throws javax.jcr.RepositoryException
      Description copied from interface: GetPrincipalAce
      Gets the principal based access control entry for a resource and principal
      Specified by:
      getPrincipalAce in interface GetPrincipalAce
      Parameters:
      jcrSession - the JCR session of the user updating the user
      resourcePath - The path of the resource to get the ACE for (required)
      principalId - the principal to get the ACE for (required)
      Returns:
      the ACE as a JSON object
      Throws:
      javax.jcr.RepositoryException - if any errors reading the information
    • getAccessControlEntriesMap

      protected Map<String,List<javax.jcr.security.AccessControlEntry>> getAccessControlEntriesMap(javax.jcr.Session session, String absPath, Principal principal, Map<Principal,Map<DeclarationType,Set<String>>> declaredAtPaths) throws javax.jcr.RepositoryException
      Specified by:
      getAccessControlEntriesMap in class AbstractGetAceServlet
      Throws:
      javax.jcr.RepositoryException
    • matchesPrincipalAccessControlEntry

      protected boolean matchesPrincipalAccessControlEntry(@NotNull @NotNull javax.jcr.security.AccessControlEntry entry, @NotNull @NotNull String resourcePath, @NotNull @NotNull Principal forPrincipal)
      Checks if the entry is for the specified principal and the effective path is equal to the resourcePath
      Parameters:
      entry - the ACE to check
      resourcePath - the resource path
      forPrincipal - the principal
      Returns:
      true for a match, false otherwise