Interface AccessManager
-
- All Known Implementing Classes:
DefaultAccessManager,SimpleAccessManager
public interface AccessManagerTheAccessManagercan be queried to determines whether privileges are granted on a specific item.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description booleancanAccess(String workspaceName)Determines whether the subject of the current context is granted access to the given workspace.booleancanRead(Path itemPath, ItemId itemId)Determines whether the item with the specifieditemPathoritemIdcan be read.voidcheckPermission(ItemId id, int permissions)Deprecated.voidcheckPermission(Path absPath, int permissions)Determines whether the specifiedpermissionsare granted on the item with the specifiedid(i.e.voidcheckRepositoryPermission(int permissions)Determines whether the specifiedpermissionsare granted on the repository level.voidclose()Close this access manager.voidinit(AMContext context)Initialize this access manager.voidinit(AMContext context, AccessControlProvider acProvider, WorkspaceAccessManager wspAccessMgr)Initialize this access manager.booleanisGranted(ItemId id, int permissions)Deprecated.booleanisGranted(Path absPath, int permissions)Determines whether the specifiedpermissionsare granted on the item with the specifiedabsPath(i.e.booleanisGranted(Path parentPath, Name childName, int permissions)Determines whether the specifiedpermissionsare granted on an item represented by the combination of the givenparentPathandchildName(i.e.
-
-
-
Field Detail
-
READ
@Deprecated static final int READ
Deprecated.READ permission constant- See Also:
- Constant Field Values
-
WRITE
@Deprecated static final int WRITE
Deprecated.WRITE permission constant- See Also:
- Constant Field Values
-
REMOVE
@Deprecated static final int REMOVE
Deprecated.REMOVE permission constant- See Also:
- Constant Field Values
-
-
Method Detail
-
init
void init(AMContext context) throws AccessDeniedException, Exception
Initialize this access manager. AnAccessDeniedExceptionwill be thrown if the subject of the givencontextis not granted access to the specified workspace.- Parameters:
context- access manager context- Throws:
AccessDeniedException- if the subject is not granted access to the specified workspace.Exception- if another error occurs
-
init
void init(AMContext context, AccessControlProvider acProvider, WorkspaceAccessManager wspAccessMgr) throws AccessDeniedException, Exception
Initialize this access manager. AnAccessDeniedExceptionwill be thrown if the subject of the givencontextis not granted access to the specified workspace.- Parameters:
context- access manager context.acProvider- The access control provider.wspAccessMgr- The workspace access manager.- Throws:
AccessDeniedException- if the subject is not granted access to the specified workspace.Exception- if another error occurs
-
close
void close() throws ExceptionClose 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
-
checkPermission
@Deprecated void checkPermission(ItemId id, int permissions) throws AccessDeniedException, ItemNotFoundException, RepositoryException
Deprecated.Determines whether the specifiedpermissionsare granted on the item with the specifiedid(i.e. the target item).- Parameters:
id- the id of the target itempermissions- A combination of one or more of the following constants encoded as a bitmask value:READWRITEREMOVE
- Throws:
AccessDeniedException- if permission is deniedItemNotFoundException- if the target item does not existRepositoryException- it an error occurs
-
checkPermission
void checkPermission(Path absPath, int permissions) throws AccessDeniedException, RepositoryException
Determines whether the specifiedpermissionsare granted on the item with the specifiedid(i.e. the target item).- Parameters:
absPath- Path to an item.permissions- A combination of one or more of thePermissionconstants encoded as a bitmask value.- Throws:
AccessDeniedException- if permission is deniedRepositoryException- it another error occurs
-
checkRepositoryPermission
void checkRepositoryPermission(int permissions) throws AccessDeniedException, RepositoryExceptionDetermines whether the specifiedpermissionsare granted on the repository level.- Parameters:
permissions- The permissions to check.- Throws:
AccessDeniedException- if permissions are denied.RepositoryException- if another error occurs.
-
isGranted
@Deprecated boolean isGranted(ItemId id, int permissions) throws ItemNotFoundException, RepositoryException
Deprecated.Determines whether the specifiedpermissionsare granted on the item with the specifiedid(i.e. the target item).- Parameters:
id- the id of the target itempermissions- A combination of one or more of the following constants encoded as a bitmask value:READWRITEREMOVE
- Returns:
trueif permission is granted; otherwisefalse- Throws:
ItemNotFoundException- if the target item does not existRepositoryException- if another error occurs
-
isGranted
boolean isGranted(Path absPath, int permissions) throws RepositoryException
Determines whether the specifiedpermissionsare granted on the item with the specifiedabsPath(i.e. the target item, that may or may not yet exist).- Parameters:
absPath- the absolute path to testpermissions- A combination of one or more of thePermissionconstants encoded as a bitmask value.- Returns:
trueif the specified permissions are granted; otherwisefalse.- Throws:
RepositoryException- if an error occurs.
-
isGranted
boolean isGranted(Path parentPath, Name childName, int permissions) throws RepositoryException
Determines whether the specifiedpermissionsare granted on an item represented by the combination of the givenparentPathandchildName(i.e. the target item, that may or may not yet exist).- Parameters:
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 thePermissionconstants encoded as a bitmask value.- Returns:
trueif the specified permissions are granted; otherwisefalse.- Throws:
RepositoryException- if an error occurs.
-
canRead
boolean canRead(Path itemPath, ItemId itemId) throws RepositoryException
Determines whether the item with the specifieditemPathoritemIdcan be read. Either of the two parameters may benull.
Note, that this method should only be called for persisted items as NEW items may not be visible to the permission evaluation. For new itemsisGranted(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.
- Parameters:
itemPath- The path to the item ornullif itemId should be used to determine the READ permission.itemId- Id of the item to be tested ornullif the itemPath should be used to determine the permission.- Returns:
trueif the item can be read; otherwisefalse.- Throws:
RepositoryException- if the item is NEW and only an itemId is specified or if another error occurs.
-
canAccess
boolean canAccess(String workspaceName) throws RepositoryException
Determines whether the subject of the current context is granted access to the given workspace. Note that an implementation is free to test for the existence of a workspace with the specified name. In this case the expected return value isfalse, if no such workspace exists.- Parameters:
workspaceName- name of workspace- Returns:
trueif the subject of the current context is granted access to the given workspace; otherwisefalse.- Throws:
RepositoryException- if an error occurs.
-
-