Package org.apache.sling.jcr.jackrabbit.accessmanager.post

# Class GetAclServlet

java.lang.Object
jakarta.servlet.GenericServlet
org.apache.sling.api.servlets.SlingJakartaSafeMethodsServlet
org.apache.sling.api.servlets.SlingJakartaAllMethodsServlet
org.apache.sling.jcr.jackrabbit.accessmanager.post.AbstractAccessServlet
org.apache.sling.jcr.jackrabbit.accessmanager.post.AbstractAccessGetServlet
org.apache.sling.jcr.jackrabbit.accessmanager.post.AbstractGetAclServlet
org.apache.sling.jcr.jackrabbit.accessmanager.post.GetAclServlet

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

public class GetAclServlet extends AbstractGetAclServlet implements GetAcl

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 Summary

Constructors
Constructor
Description
`GetAclServlet()`

## Method Summary

Modifier and Type
Method
Description
`protected Map<String,List<javax.jcr.security.AccessControlEntry>>`
`getAccessControlEntriesMap(javax.jcr.Session session, String absPath, Map<Principal,Map<DeclarationType,Set<String>>> declaredAtPaths)`
`jakarta.json.JsonObject`
`getAcl(javax.jcr.Session jcrSession, String resourcePath)`
Gets the access control list for a resource.

### Methods inherited from class org.apache.sling.jcr.jackrabbit.accessmanager.post.AbstractGetAclServlet

`addExtraInfo, convertToJson, internalGetAcl, internalJson`

### Methods inherited from class org.apache.sling.jcr.jackrabbit.accessmanager.post.AbstractAccessGetServlet

`doGet, entriesSortedByEffectivePath, getItemPath, processACE, validateArgs, validateArgs, validateResourcePath`

### Methods inherited from class org.apache.sling.jcr.jackrabbit.accessmanager.post.AbstractAccessServlet

`bindRestrictionProvider, getRestrictionProvider, unbindRestrictionProvider`

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

`doDelete, doPost, doPut, getAllowedRequestMethods, isMethodValid, mayService`

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

`doGeneric, 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`

## Constructor Details

### GetAclServlet

public GetAclServlet()

## Method Details

### getAcl

public jakarta.json.JsonObject getAcl(javax.jcr.Session jcrSession, String resourcePath) throws javax.jcr.RepositoryException
Description copied from interface: `GetAcl`
Gets the access control list for a resource.

Specified by:
  `getAcl` in interface `GetAcl`
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

### getAccessControlEntriesMap

protected Map<String,List<javax.jcr.security.AccessControlEntry>> getAccessControlEntriesMap(javax.jcr.Session session, String absPath, Map<Principal,Map<DeclarationType,Set<String>>> declaredAtPaths) throws javax.jcr.RepositoryException

Specified by:
  `getAccessControlEntriesMap` in class `AbstractGetAclServlet`
Throws:
  `javax.jcr.RepositoryException`