|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.jackrabbit.core.security.AbstractAccessControlManager
org.apache.jackrabbit.core.security.DefaultAccessManager
public class DefaultAccessManager
The DefaultAccessManager controls access by evaluating access
control policies for the Subject attached to the
Session this manager has been built for.
Please note the following exceptional situations:
This manager allows all privileges for a particular item if
SystemPrincipal or
an AdminPrincipalWorkspaceAccessManager is defined.AccessControlProvider set to this AccessManager.
AccessManager,
AccessControlManager| Field Summary |
|---|
| Fields inherited from interface org.apache.jackrabbit.core.security.AccessManager |
|---|
READ, REMOVE, WRITE |
| Constructor Summary | |
|---|---|
DefaultAccessManager()
|
|
| Method Summary | |
|---|---|
boolean |
canAccess(java.lang.String workspaceName)
Determines whether the subject of the current context is granted access to the given workspace. |
boolean |
canRead(Path itemPath)
Determines whether the item at the specified absolute path 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. |
protected void |
checkPrivileges(java.lang.String absPath,
int privileges)
Check if the specified privileges are granted at absPath. |
protected void |
checkValidNodePath(java.lang.String absPath)
Build a qualified path from the specified absPath and test
if it is really absolute and points to an existing node. |
void |
close()
Close this access manager. |
AccessControlPolicy[] |
getApplicablePolicies(java.security.Principal principal)
Returns the editable policies for the specified principal. |
AccessControlPolicyIterator |
getApplicablePolicies(java.lang.String absPath)
Returns an empty iterator. |
AccessControlPolicy[] |
getEffectivePolicies(java.lang.String absPath)
Returns the AccessControlPolicy objects that currently are
in effect at the node at absPath. |
AccessControlPolicy[] |
getPolicies(java.lang.String absPath)
Returns null. |
protected PrivilegeRegistry |
getPrivilegeRegistry()
|
Privilege[] |
getPrivileges(java.lang.String absPath)
Returns the privileges the session has for absolute path absPath, which must be an existing node. |
boolean |
hasPrivileges(java.lang.String absPath,
Privilege[] privileges)
Returns whether the session has the specified privileges for absolute path absPath, which must be an existing node. |
void |
init(AMContext amContext)
Initialize this access manager. |
void |
init(AMContext amContext,
AccessControlProvider acProvider,
WorkspaceAccessManager wspAccessManager)
Initialize this access manager. |
boolean |
isGranted(ItemId id,
int actions)
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. |
void |
removePolicy(java.lang.String absPath,
AccessControlPolicy policy)
Always throws AccessControlException |
void |
setPolicy(java.lang.String absPath,
AccessControlPolicy policy)
Always throws AccessControlException |
| Methods inherited from class org.apache.jackrabbit.core.security.AbstractAccessControlManager |
|---|
getSupportedPrivileges, privilegeFromName |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DefaultAccessManager()
| Method Detail |
|---|
public void init(AMContext amContext)
throws javax.jcr.AccessDeniedException,
java.lang.Exception
AccessManagerAccessDeniedException will
be thrown if the subject of the given context is not
granted access to the specified workspace.
init in interface AccessManageramContext - access manager context
javax.jcr.AccessDeniedException - if the subject is not granted access
to the specified workspace.
java.lang.Exception - if another error occursAccessManager.init(AMContext)
public void init(AMContext amContext,
AccessControlProvider acProvider,
WorkspaceAccessManager wspAccessManager)
throws javax.jcr.AccessDeniedException,
java.lang.Exception
AccessManagerAccessDeniedException will
be thrown if the subject of the given context is not
granted access to the specified workspace.
init in interface AccessManageramContext - access manager context
javax.jcr.AccessDeniedException - if the subject is not granted access
to the specified workspace.
java.lang.Exception - if another error occursAccessManager.init(AMContext, AccessControlProvider, WorkspaceAccessManager)
public void close()
throws java.lang.Exception
AccessManager
close in interface AccessManagerjava.lang.Exception - if an error occursAccessManager.close()
public void checkPermission(ItemId id,
int permissions)
throws javax.jcr.AccessDeniedException,
javax.jcr.ItemNotFoundException,
javax.jcr.RepositoryException
AccessManagerpermissions are granted
on the item with the specified id (i.e. the target item).
checkPermission in interface AccessManagerid - the id of the target itempermissions - A combination of one or more of the following constants
encoded as a bitmask value:
READWRITEREMOVEjavax.jcr.AccessDeniedException - if permission is denied
javax.jcr.ItemNotFoundException - if the target item does not exist
javax.jcr.RepositoryException - it an error occursAccessManager.checkPermission(ItemId, int)
public boolean isGranted(ItemId id,
int actions)
throws javax.jcr.ItemNotFoundException,
javax.jcr.RepositoryException
AccessManagerpermissions are granted
on the item with the specified id (i.e. the target item).
isGranted in interface AccessManagerid - the id of the target itemactions - A combination of one or more of the following constants
encoded as a bitmask value:
READWRITEREMOVEtrue if permission is granted; otherwise false
javax.jcr.ItemNotFoundException - if the target item does not exist
javax.jcr.RepositoryException - if another error occursAccessManager.isGranted(ItemId, int)
public boolean isGranted(Path absPath,
int permissions)
throws javax.jcr.RepositoryException
AccessManagerpermissions are granted
on the item with the specified absPath (i.e. the target
item, that may or may not yet exist).
isGranted in interface AccessManagerabsPath - the absolute path to testpermissions - A combination of one or more of the following constants
encoded as a bitmask value:
true if the specified permissions are granted;
otherwise false.
javax.jcr.RepositoryException - if an error occurs.AccessManager.isGranted(Path, int)
public boolean isGranted(Path parentPath,
Name childName,
int permissions)
throws javax.jcr.RepositoryException
AccessManagerpermissions 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 AccessManagerparentPath - 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 following constants
encoded as a bitmask value:
true if the specified permissions are granted;
otherwise false.
javax.jcr.RepositoryException - if an error occurs.AccessManager.isGranted(Path, Name, int)
public boolean canRead(Path itemPath)
throws javax.jcr.RepositoryException
AccessManager
canRead in interface AccessManagertrue if the item can be read; otherwise false.
javax.jcr.RepositoryException - if an error occurs.AccessManager.canRead(Path)
public boolean canAccess(java.lang.String workspaceName)
throws javax.jcr.RepositoryException
AccessManagerfalse, if no such workspace
exists.
canAccess in interface AccessManagerworkspaceName - name of workspace
true if the subject of the current context is
granted access to the given workspace; otherwise false.
javax.jcr.RepositoryException - if an error occurs.AccessManager.canAccess(String)
public boolean hasPrivileges(java.lang.String absPath,
Privilege[] privileges)
throws javax.jcr.PathNotFoundException,
javax.jcr.RepositoryException
AccessControlManagerabsPath, which must be an existing node.
Testing an aggregate privilege is equivalent to testing each non aggregate
privilege among the set returned by calling
Privilege.getAggregatePrivileges() for that privilege.
The results reported by the this method reflect the net
effect of the currently applied control mechanisms. It does not reflect
unsaved access control policies or unsaved access control entries.
Changes to access control status caused by these mechanisms only take effect
on Session.save() and are only then reflected in the results of
the privilege test methods.
A PathNotFoundException is thrown if no node at
absPath exists or the session does not have privilege to
retrieve the node.
A RepositoryException is thrown if another error occurs.
hasPrivileges in interface AccessControlManagerabsPath - an absolute path.privileges - an array of Privileges.
true if the session has the specified privileges;
false otherwise.
javax.jcr.PathNotFoundException - if no node at absPath exists
or the session does not have privilege to
retrieve the node.
javax.jcr.RepositoryException - if another error occurs.AccessControlManager.hasPrivileges(String, Privilege[])
public Privilege[] getPrivileges(java.lang.String absPath)
throws javax.jcr.PathNotFoundException,
javax.jcr.RepositoryException
AccessControlManagerAccessControlManager.hasPrivileges(java.lang.String, org.apache.jackrabbit.api.jsr283.security.Privilege[]) would
return true.
The results reported by the this method reflect the net
effect of the currently applied control mechanisms. It does not reflect
unsaved access control policies or unsaved access control entries.
Changes to access control status caused by these mechanisms only take effect
on Session.save() and are only then reflected in the results of
the privilege test methods.
A PathNotFoundException is thrown if no node at
absPath exists or the session does not have privilege to
retrieve the node.
A RepositoryException is thrown if another error occurs.
getPrivileges in interface AccessControlManagerabsPath - an absolute path.
Privileges.
javax.jcr.PathNotFoundException - if no node at absPath exists
or the session does not have privilege to
retrieve the node.
javax.jcr.RepositoryException - if another error occurs.AccessControlManager.getPrivileges(String)
public AccessControlPolicy[] getPolicies(java.lang.String absPath)
throws javax.jcr.PathNotFoundException,
javax.jcr.AccessDeniedException,
javax.jcr.RepositoryException
AbstractAccessControlManagernull.
getPolicies in interface AccessControlManagergetPolicies in class AbstractAccessControlManagerabsPath - an absolute path.
null.
javax.jcr.PathNotFoundException - if no node at absPath exists
or the session does not have privilege to
retrieve the node.
javax.jcr.AccessDeniedException - if the session lacks
READ_ACCESS_CONTROL privilege
for the absPath node.
javax.jcr.RepositoryException - if another error occurs.AccessControlManager.getPolicies(String)
public AccessControlPolicy[] getEffectivePolicies(java.lang.String absPath)
throws javax.jcr.PathNotFoundException,
javax.jcr.AccessDeniedException,
javax.jcr.RepositoryException
AccessControlManagerAccessControlPolicy objects that currently are
in effect at the node at absPath. This may be policies
set through this API or some implementation specific (default) policies.
A PathNotFoundException is thrown if no node at
absPath exists or the session does not have privilege to
retrieve the node.
An AccessDeniedException is thrown if the session lacks
READ_ACCESS_CONTROL privilege for the absPath node.
A RepositoryException is thrown if another error occurs.
getEffectivePolicies in interface AccessControlManagerabsPath - an absolute path.
AccessControlPolicy objects.
javax.jcr.PathNotFoundException - if no node at absPath exists
or the session does not have privilege to
retrieve the node.
javax.jcr.AccessDeniedException - if the session lacks
READ_ACCESS_CONTROL privilege
for the absPath node.
javax.jcr.RepositoryException - if another error occurs.AccessControlManager.getEffectivePolicies(String)
public AccessControlPolicyIterator getApplicablePolicies(java.lang.String absPath)
throws javax.jcr.PathNotFoundException,
javax.jcr.AccessDeniedException,
javax.jcr.RepositoryException
AbstractAccessControlManager
getApplicablePolicies in interface AccessControlManagergetApplicablePolicies in class AbstractAccessControlManagerabsPath - an absolute path.
javax.jcr.PathNotFoundException - if no node at absPath exists
or the session does not have privilege to
retrieve the node.
javax.jcr.AccessDeniedException - if the session lacks
READ_ACCESS_CONTROL privilege
for the absPath node.
javax.jcr.RepositoryException - if another error occurs.AccessControlManager.getApplicablePolicies(String)
public void setPolicy(java.lang.String absPath,
AccessControlPolicy policy)
throws javax.jcr.PathNotFoundException,
AccessControlException,
javax.jcr.AccessDeniedException,
javax.jcr.RepositoryException
AbstractAccessControlManagerAccessControlException
setPolicy in interface AccessControlManagersetPolicy in class AbstractAccessControlManagerabsPath - an absolute path.policy - the AccessControlPolicy to be applied.
javax.jcr.PathNotFoundException - if no node at absPath exists
or the session does not have privilege to
retrieve the node.
AccessControlException - if the policy is not applicable.
javax.jcr.AccessDeniedException - if the session lacks
MODIFY_ACCESS_CONTROL
privilege for the absPath node.
javax.jcr.lock.LockException - if a lock applies at the node at
absPath and this implementation
performs this validation immediately instead
of waiting until save.
javax.jcr.version.VersionException - if the node at absPath is
versionable and checked-in or is non-versionable
but its nearest versionable ancestor is
checked-in and this implementation performs
this validation immediately instead of
waiting until save.
javax.jcr.RepositoryException - if another error occurs.AccessControlManager.setPolicy(String, AccessControlPolicy)
public void removePolicy(java.lang.String absPath,
AccessControlPolicy policy)
throws javax.jcr.PathNotFoundException,
AccessControlException,
javax.jcr.AccessDeniedException,
javax.jcr.RepositoryException
AbstractAccessControlManagerAccessControlException
removePolicy in interface AccessControlManagerremovePolicy in class AbstractAccessControlManagerabsPath - an absolute path.policy - the policy to be removed.
javax.jcr.PathNotFoundException - if no node at absPath exists
or the session does not have privilege to
retrieve the node.
AccessControlException - if no policy exists.
javax.jcr.AccessDeniedException - if the session lacks
MODIFY_ACCESS_CONTROL
privilege for the absPath node.
javax.jcr.lock.LockException - if a lock applies at the node at
absPath and this implementation
performs this validation immediately instead
of waiting until save.
javax.jcr.version.VersionException - if the node at absPath is
versionable and checked-in or is non-versionable
but its nearest versionable ancestor is
checked-in and this implementation performs
this validation immediately instead of
waiting until save.
javax.jcr.RepositoryException - if another error occurs.AccessControlManager.removePolicy(String, AccessControlPolicy)
public AccessControlPolicy[] getApplicablePolicies(java.security.Principal principal)
throws javax.jcr.AccessDeniedException,
AccessControlException,
javax.jcr.UnsupportedRepositoryOperationException,
javax.jcr.RepositoryException
AbstractAccessControlManagerprincipal.
getApplicablePolicies in interface JackrabbitAccessControlManagergetApplicablePolicies in class AbstractAccessControlManagerprincipal. Note
that the policy object returned must reveal the path of the node where
they can be applied later on.
javax.jcr.AccessDeniedException - if the session lacks
MODIFY_ACCESS_CONTROL privilege.
AccessControlException - if the specified principal does not exist
or if same other access control related exception occurs.
javax.jcr.UnsupportedRepositoryOperationException - if editing the policy
is not supported.
javax.jcr.RepositoryException - if another error occurs.JackrabbitAccessControlManager.getApplicablePolicies(Principal)protected void checkInitialized()
AbstractAccessControlManager
checkInitialized in class AbstractAccessControlManagerAbstractAccessControlManager.checkInitialized()
protected void checkValidNodePath(java.lang.String absPath)
throws javax.jcr.PathNotFoundException,
javax.jcr.RepositoryException
AbstractAccessControlManagerabsPath and test
if it is really absolute and points to an existing node.
checkValidNodePath in class AbstractAccessControlManagerjavax.jcr.PathNotFoundException - if no node at absPath exists
or the session does not have privilege to retrieve the node.
javax.jcr.RepositoryException - If the given absPath is not
absolute or if some other error occurs.AbstractAccessControlManager.checkValidNodePath(String)
protected void checkPrivileges(java.lang.String absPath,
int privileges)
throws javax.jcr.AccessDeniedException,
javax.jcr.RepositoryException
AbstractAccessControlManagerabsPath.
checkPrivileges in class AbstractAccessControlManagerjavax.jcr.AccessDeniedException - if the session does not have the
specified privileges.
javax.jcr.PathNotFoundException - if no node exists at absPath
of if the session does not have the privilege to READ it.
javax.jcr.RepositoryExceptionAbstractAccessControlManager.checkPrivileges(String, int)
protected PrivilegeRegistry getPrivilegeRegistry()
throws javax.jcr.RepositoryException
getPrivilegeRegistry in class AbstractAccessControlManagerjavax.jcr.RepositoryExceptionAbstractAccessControlManager.getPrivilegeRegistry()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||