org.apache.sling.jcr.jackrabbit.server.security.accessmanager

## Interface AccessManagerPlugin

    public interface AccessManagerPlugin

A simplified AccessManager interface.

### Field Summary

Fields
`static int` `ADD_NODE`
`static int` `ALL`
`static int` `NONE`
`static int` `READ`
`static int` `REMOVE_NODE`
`static int` `REMOVE_PROPERTY`
`static int` `SET_PROPERTY`

### Method Summary

Methods
`boolean` `canRead(String itemPath)` Determines whether the item at the specified absolute path can be read.
`void` `close()` Close this access manager.
`WorkspaceAccessManagerPlugin` `getWorkspaceAccessManager()` Returns the `WorkspaceAccessManagerPlugin` to be used for checking Workspace access.
`void` `init(Subject subject, javax.jcr.Session session)` Initialize this access manager.
`boolean` `isGranted(String absPath, int permissions)` Determines whether the specified `permissions` are granted on the item with the specified `absPath` (i.e. the target item, that may or may not yet exist).

### Field Detail

#### READ

    static final int READ

See Also:
  Constant Field Values

#### ADD_NODE

    static final int ADD_NODE

See Also:
  Constant Field Values

#### REMOVE_NODE

    static final int REMOVE_NODE

See Also:
  Constant Field Values

#### SET_PROPERTY

    static final int SET_PROPERTY

See Also:
  Constant Field Values

#### REMOVE_PROPERTY

    static final int REMOVE_PROPERTY

See Also:
  Constant Field Values

#### ALL

    static final int ALL

See Also:
  Constant Field Values

#### NONE

    static final int NONE

See Also:
  Constant Field Values

### Method Detail

#### init

    void init(Subject subject,
            javax.jcr.Session session)
              throws javax.jcr.AccessDeniedException,
                     Exception

Initialize this access manager. An `AccessDeniedException` will be thrown if the subject of the given `context` is not granted access to the specified workspace.

Parameters:
  `subject` - The authenticated Subject
  `session` - The current JCR session
Throws:
  `javax.jcr.AccessDeniedException`
  `Exception`

#### close

    void close()
               throws Exception

Close this access manager. After having closed an access manager, further operations on this object are treated as illegal and throw

Throws:
  `Exception` - if an error occurs

#### isGranted

    boolean isGranted(String absPath,
                    int permissions)
                      throws javax.jcr.RepositoryException

Determines whether the specified `permissions` are granted on the item with the specified `absPath` (i.e. the target item, that may or may not yet exist).

Parameters:
  `absPath` - the absolute path to test
  `permissions` - A combination of one or more of the following constants encoded as a bitmask value:
  - `READ`
  - `ADD_NODE`
  - `REMOVE_NODE`
  - `SET_PROPERTY`
  - `REMOVE_PROPERTY`
Returns:
  `true` if the specified permissions are granted; otherwise `false`.
Throws:
  `javax.jcr.RepositoryException` - if an error occurs.

#### canRead

    boolean canRead(String itemPath)
                    throws javax.jcr.RepositoryException

Determines whether the item at the specified absolute path can be read.

Parameters:
  `itemPath` - Absolute path to the item being accessed
Returns:
  `true` if the item can be read; otherwise `false`.
Throws:
  `javax.jcr.RepositoryException` - if an error occurs.

#### getWorkspaceAccessManager

    WorkspaceAccessManagerPlugin getWorkspaceAccessManager()

Returns the `WorkspaceAccessManagerPlugin` to be used for checking Workspace access. If `null` is returned, the default `WorkspaceAccessManager` will be used.

Returns:
  An implementation of `WorkspaceAccessManagerPlugin`, or `null` to use the default `WorkspaceAccessManager`.