public class SimpleAccessManager extends AbstractAccessControlManager implements AccessManager
SimpleAccessManager
...READ, REMOVE, WRITE
Constructor and Description |
---|
SimpleAccessManager()
Empty constructor
|
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. |
protected void |
checkInitialized()
Check if this manager has been properly initialized.
|
void |
checkPermission(ItemId id,
int permissions)
Determines whether the specified
permissions are granted
on the item with the specified id (i.e. |
void |
checkPermission(Path absPath,
int permissions)
Determines whether the specified
permissions are granted
on the item with the specified id (i.e. |
protected void |
checkPermission(String absPath,
int permission)
Check if the specified privileges are granted at
absPath . |
void |
checkRepositoryPermission(int permissions)
Determines whether the specified
permissions are granted
on the repository level. |
protected void |
checkValidNodePath(String absPath)
Tests if the given
absPath is absolute and points to an existing node. |
void |
close()
Close this access manager.
|
AccessControlPolicy[] |
getEffectivePolicies(Set<Principal> principals) |
AccessControlPolicy[] |
getEffectivePolicies(String absPath) |
protected org.apache.jackrabbit.api.security.authorization.PrivilegeManager |
getPrivilegeManager() |
Privilege[] |
getPrivileges(String absPath) |
Privilege[] |
getPrivileges(String absPath,
Set<Principal> principals) |
boolean |
hasPrivileges(String absPath,
Privilege[] privileges) |
boolean |
hasPrivileges(String absPath,
Set<Principal> principals,
Privilege[] privileges) |
void |
init(AMContext context)
Initialize this access manager.
|
void |
init(AMContext context,
AccessControlProvider acProvider,
WorkspaceAccessManager wspAccessManager)
Initialize this access manager.
|
boolean |
isGranted(ItemId id,
int permissions)
Determines whether the specified
permissions are granted
on the item with the specified id (i.e. |
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. |
getApplicablePolicies, getApplicablePolicies, getPolicies, getPolicies, getSupportedPrivileges, privilegeFromName, removePolicy, setPolicy
public 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.init
in interface AccessManager
context
- access manager contextAccessDeniedException
- if the subject is not granted access
to the specified workspace.Exception
- if another error occurspublic void init(AMContext context, AccessControlProvider acProvider, WorkspaceAccessManager wspAccessManager) throws AccessDeniedException, Exception
AccessDeniedException
will
be thrown if the subject of the given context
is not
granted access to the specified workspace.init
in interface AccessManager
context
- access manager context.acProvider
- The access control provider.wspAccessManager
- The workspace access manager.AccessDeniedException
- if the subject is not granted access
to the specified workspace.Exception
- if another error occurspublic void close() throws Exception
close
in interface AccessManager
Exception
- if an error occurspublic void checkPermission(ItemId id, int permissions) throws AccessDeniedException, RepositoryException
permissions
are granted
on the item with the specified id
(i.e. the target item).checkPermission
in interface AccessManager
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 occurspublic void checkPermission(Path absPath, int permissions) throws AccessDeniedException, RepositoryException
permissions
are granted
on the item with the specified id
(i.e. the target item).checkPermission
in interface AccessManager
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 occurspublic void checkRepositoryPermission(int permissions) throws AccessDeniedException, RepositoryException
permissions
are granted
on the repository level.checkRepositoryPermission
in interface AccessManager
permissions
- The permissions to check.AccessDeniedException
- if permissions are denied.RepositoryException
- if another error occurs.public boolean isGranted(ItemId id, int permissions) throws RepositoryException
permissions
are granted
on the item with the specified id
(i.e. the target item).isGranted
in interface AccessManager
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 occurspublic boolean isGranted(Path absPath, int permissions) throws RepositoryException
AccessManager
permissions
are granted
on the item with the specified absPath
(i.e. the target
item, that may or may not yet exist).isGranted
in interface AccessManager
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.public boolean isGranted(Path parentPath, Name childName, int permissions) throws RepositoryException
AccessManager
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).isGranted
in interface AccessManager
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.public boolean canRead(Path itemPath, ItemId itemId) throws RepositoryException
AccessManager
itemPath
or itemId
can be read. Either of the two parameters
may be null
.AccessManager.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.
canRead
in interface AccessManager
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.public boolean canAccess(String workspaceName) throws RepositoryException
false
, if no such workspace
exists.canAccess
in interface AccessManager
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.public boolean hasPrivileges(String absPath, Privilege[] privileges) throws PathNotFoundException, RepositoryException
hasPrivileges
in interface AccessControlManager
PathNotFoundException
RepositoryException
public Privilege[] getPrivileges(String absPath) throws PathNotFoundException, RepositoryException
getPrivileges
in interface AccessControlManager
PathNotFoundException
RepositoryException
public AccessControlPolicy[] getEffectivePolicies(String absPath) throws PathNotFoundException, AccessDeniedException, RepositoryException
getEffectivePolicies
in interface AccessControlManager
PathNotFoundException
AccessDeniedException
RepositoryException
protected void checkInitialized() throws IllegalStateException
AbstractAccessControlManager
checkInitialized
in class AbstractAccessControlManager
IllegalStateException
- If this manager has not been properly initialized.AbstractAccessControlManager.checkInitialized()
protected void checkPermission(String absPath, int permission) throws AccessDeniedException, PathNotFoundException, RepositoryException
AbstractAccessControlManager
absPath
.checkPermission
in class AbstractAccessControlManager
absPath
- Path to an existing node.permission
- Permissions to be checked.AccessDeniedException
- if the session does not have the
specified privileges.PathNotFoundException
- if no node exists at absPath
of if the session does not have the permission to READ it.RepositoryException
- If another error occurs.AbstractAccessControlManager.checkPermission(String,int)
protected org.apache.jackrabbit.api.security.authorization.PrivilegeManager getPrivilegeManager() throws RepositoryException
getPrivilegeManager
in class AbstractAccessControlManager
RepositoryException
- If another error occurs.AbstractAccessControlManager.getPrivilegeManager()
protected void checkValidNodePath(String absPath) throws PathNotFoundException, RepositoryException
AbstractAccessControlManager
absPath
is absolute and points to an existing node.checkValidNodePath
in class AbstractAccessControlManager
absPath
- Path to an existing node.PathNotFoundException
- if no node at absPath
exists
or the session does not have privilege to retrieve the node.RepositoryException
- If the given absPath
is not
absolute or if some other error occurs.AbstractAccessControlManager.checkValidNodePath(String)
public AccessControlPolicy[] getEffectivePolicies(Set<Principal> principals) throws AccessDeniedException, AccessControlException, UnsupportedRepositoryOperationException, RepositoryException
getEffectivePolicies
in interface org.apache.jackrabbit.api.security.JackrabbitAccessControlManager
AccessDeniedException
AccessControlException
UnsupportedRepositoryOperationException
RepositoryException
JackrabbitAccessControlManager.getEffectivePolicies(Set)
public boolean hasPrivileges(String absPath, Set<Principal> principals, Privilege[] privileges) throws PathNotFoundException, RepositoryException
hasPrivileges
in interface org.apache.jackrabbit.api.security.JackrabbitAccessControlManager
PathNotFoundException
RepositoryException
JackrabbitAccessControlManager.hasPrivileges(String, Set, Privilege[])
public Privilege[] getPrivileges(String absPath, Set<Principal> principals) throws PathNotFoundException, RepositoryException
getPrivileges
in interface org.apache.jackrabbit.api.security.JackrabbitAccessControlManager
PathNotFoundException
RepositoryException
JackrabbitAccessControlManager.getPrivileges(String, Set)
Copyright © 2004–2024 The Apache Software Foundation. All rights reserved.