Class GetEffectiveAclServlet

  • All Implemented Interfaces:
    Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig, GetEffectiveAcl

    public class GetEffectiveAclServlet
    extends AbstractGetAclServlet
    implements GetEffectiveAcl

    Sling GET servlet implementation for dumping the declared ACL of a resource to JSON.

    Rest Service Description

    Mapped to the default resourceType. Gets and Acl for a resource. Get of the form >resource<.acl.json Provided the user has access to the ACL, they get a chunk of JSON of the form.

    Transport Details:

    Methods

    • GET

    Response

    200
    Success.
    404
    The resource was not found.
    500
    Failure. HTML explains the failure.

    Example Response

    { "principalNameA":{ "permissions": { "permission1":{ "allow":true }, "permission2":{ "allow":true }, "permission5":{ "deny":true } }, "principalNameB":{ "permissions": { "permission1":{ "allow":true }, "permission2":{ "allow":[ "restrictionName1: "restrictionValue1", "restrictionName2: [ "restrictionValue2a", "restrictionValue2b" ] ] }, "permission5":{ "deny":true } } }
    See Also:
    Serialized Form
    • Constructor Detail

      • GetEffectiveAclServlet

        public GetEffectiveAclServlet()
    • Method Detail

      • getEffectiveAcl

        public javax.json.JsonObject getEffectiveAcl​(javax.jcr.Session jcrSession,
                                                     String resourcePath)
                                              throws javax.jcr.RepositoryException
        Description copied from interface: GetEffectiveAcl
        Gets the effective access control list for a resource.
        Specified by:
        getEffectiveAcl in interface GetEffectiveAcl
        Parameters:
        jcrSession - the JCR session of the user updating the user
        resourcePath - The path of the resource to get the ACL for (required)
        Returns:
        the ACL as a JSON object
        Throws:
        javax.jcr.RepositoryException - if any errors reading the information
      • addExtraInfo

        protected void addExtraInfo​(javax.json.JsonObjectBuilder principalJson,
                                    Principal principal,
                                    Map<Principal,​Map<DeclarationType,​Set<String>>> principalToDeclaredAtPaths)
        Overridden to add the declaredAt data to the json
        Overrides:
        addExtraInfo in class AbstractGetAclServlet
        principal - the current principal
        principalToDeclaredAtPaths - a map of principal the paths where ACEs are declared