public interface AccessManager
AccessManager
can be queried to determines whether privileges
are granted on a specific item.Modifier and Type | Field and Description |
---|---|
static int |
READ
Deprecated.
|
static int |
REMOVE
Deprecated.
|
static int |
WRITE
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canAccess(String workspaceName)
Determines whether the subject of the current context is granted access
to the given workspace.
|
boolean |
canRead(Path itemPath,
ItemId itemId)
Determines whether the item with the specified
itemPath
or itemId can be read. |
void |
checkPermission(ItemId id,
int permissions)
Deprecated.
|
void |
checkPermission(Path absPath,
int permissions)
Determines whether the specified
permissions are granted
on the item with the specified id (i.e. |
void |
checkRepositoryPermission(int permissions)
Determines whether the specified
permissions are granted
on the repository level. |
void |
close()
Close this access manager.
|
void |
init(AMContext context)
Initialize this access manager.
|
void |
init(AMContext context,
AccessControlProvider acProvider,
WorkspaceAccessManager wspAccessMgr)
Initialize this access manager.
|
boolean |
isGranted(ItemId id,
int permissions)
Deprecated.
|
boolean |
isGranted(Path absPath,
int permissions)
Determines whether the specified
permissions are granted
on the item with the specified absPath (i.e. |
boolean |
isGranted(Path parentPath,
Name childName,
int permissions)
Determines whether the specified
permissions are granted
on an item represented by the combination of the given
parentPath and childName (i.e. |
static final int READ
static final int WRITE
static final int REMOVE
void init(AMContext context) throws AccessDeniedException, Exception
AccessDeniedException
will
be thrown if the subject of the given context
is not
granted access to the specified workspace.context
- access manager contextAccessDeniedException
- if the subject is not granted access
to the specified workspace.Exception
- if another error occursvoid init(AMContext context, AccessControlProvider acProvider, WorkspaceAccessManager wspAccessMgr) throws AccessDeniedException, Exception
AccessDeniedException
will
be thrown if the subject of the given context
is not
granted access to the specified workspace.context
- access manager context.acProvider
- The access control provider.wspAccessMgr
- The workspace access manager.AccessDeniedException
- if the subject is not granted access
to the specified workspace.Exception
- if another error occursvoid close() throws Exception
Exception
- if an error occursvoid checkPermission(ItemId id, int permissions) throws AccessDeniedException, ItemNotFoundException, RepositoryException
permissions
are granted
on the item with the specified id
(i.e. the target item).id
- the id of the target itempermissions
- A combination of one or more of the following constants
encoded as a bitmask value:
READ
WRITE
REMOVE
AccessDeniedException
- if permission is deniedItemNotFoundException
- if the target item does not existRepositoryException
- it an error occursvoid checkPermission(Path absPath, int permissions) throws AccessDeniedException, RepositoryException
permissions
are granted
on the item with the specified id
(i.e. the target item).absPath
- Path to an item.permissions
- A combination of one or more of the
Permission
constants encoded as a bitmask value.AccessDeniedException
- if permission is deniedRepositoryException
- it another error occursvoid checkRepositoryPermission(int permissions) throws AccessDeniedException, RepositoryException
permissions
are granted
on the repository level.permissions
- The permissions to check.AccessDeniedException
- if permissions are denied.RepositoryException
- if another error occurs.boolean isGranted(ItemId id, int permissions) throws ItemNotFoundException, RepositoryException
permissions
are granted
on the item with the specified id
(i.e. the target item).id
- the id of the target itempermissions
- A combination of one or more of the following constants
encoded as a bitmask value:
READ
WRITE
REMOVE
true
if permission is granted; otherwise false
ItemNotFoundException
- if the target item does not existRepositoryException
- if another error occursboolean isGranted(Path absPath, int permissions) throws RepositoryException
permissions
are granted
on the item with the specified absPath
(i.e. the target
item, that may or may not yet exist).absPath
- the absolute path to testpermissions
- A combination of one or more of the
Permission
constants encoded as a bitmask value.true
if the specified permissions are granted;
otherwise false
.RepositoryException
- if an error occurs.boolean isGranted(Path parentPath, Name childName, int permissions) throws RepositoryException
permissions
are granted
on an item represented by the combination of the given
parentPath
and childName
(i.e. the target
item, that may or may not yet exist).parentPath
- Path to an existing parent node.childName
- Name of the child item that may or may not exist yet.permissions
- A combination of one or more of the
Permission
constants encoded as a bitmask value.true
if the specified permissions are granted;
otherwise false
.RepositoryException
- if an error occurs.boolean canRead(Path itemPath, ItemId itemId) throws RepositoryException
itemPath
or itemId
can be read. Either of the two parameters
may be null
.isGranted(Path, int)
should be used instead.
If this method is called with both Path and ItemId it is left to the evaluation, which parameter is used.
itemPath
- The path to the item or null
if itemId
should be used to determine the READ permission.itemId
- Id of the item to be tested or null
if the
itemPath should be used to determine the permission.true
if the item can be read; otherwise false
.RepositoryException
- if the item is NEW and only an itemId is
specified or if another error occurs.boolean canAccess(String workspaceName) throws RepositoryException
false
, if no such workspace
exists.workspaceName
- name of workspacetrue
if the subject of the current context is
granted access to the given workspace; otherwise false
.RepositoryException
- if an error occurs.Copyright © 2004–2021 The Apache Software Foundation. All rights reserved.