Interface AccessControlProvider
-
- All Known Implementing Classes:
AbstractAccessControlProvider,ACLProvider,ACLProvider,CombinedProvider,UserAccessControlProvider
public interface AccessControlProviderThe AccessControlProvider is used to provide access control policy and entry objects that apply to an item in a single workspace. The provider is bound to a system session in contrast to theAccessControlManagerthat is bound to a specific session/subject.Please note following additional special conditions:
- The detection of access control policy/entries is an implementation detail. They may be resource based or retrieved by other means.
- An access control policy/entry may be inherited across the item hierarchy. The details are left to the implementation
- If no policy can be determined for a particular Item the implementation must return some implementation specific default policy.
- Transient (NEW) items created within a regular Session object are unknown
to and cannot be handled by the
AccessControlProvider. - If the item id passed to the corresponding calls doesn't point to an
existing item,
ItemNotFoundExceptionwill be thrown. It is therefore recommended to evaluate the id of the closest not-new ancestor node before calling any methods on the provider. - Changes to access control policy and entries made through the
AccessControlEditorare not effective unless they are persisted by callingSession.save()on the session that has been used to obtain the editor.
- See Also:
AccessControlProviderFactory
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleancanAccessRoot(Set<Principal> principals)Returnstrueif the given set of principals can access the root node of the workspace this provider has been built for;falseotherwise.voidclose()Closes this provider when it is no longer used by the respective workspace and release resources bound by this provider.CompiledPermissionscompilePermissions(Set<Principal> principals)Compiles the effective policy for the specified set ofPrincipals.AccessControlEditorgetEditor(Session session)Returns anAccessControlEditorfor the given Session object ornullif the implementation does not support editing of access control policies.AccessControlPolicy[]getEffectivePolicies(Set<Principal> principals, CompiledPermissions permissions)Returns the effective policies for the given principals.AccessControlPolicy[]getEffectivePolicies(Path absPath, CompiledPermissions permissions)Returns the effective policies for the node at the given absPath.voidinit(Session systemSession, Map configuration)Allows theAccessControlProviderFactoryto pass a session and configuration parameters to theAccessControlProvider.booleanisLive()Returnstrue, if this provider is still alive and able to evaluate permissions;falseotherwise.
-
-
-
Method Detail
-
init
void init(Session systemSession, Map configuration) throws RepositoryException
Allows theAccessControlProviderFactoryto pass a session and configuration parameters to theAccessControlProvider.- Parameters:
systemSession- System session.configuration- Configuration used to initialize this provider.- Throws:
RepositoryException- If an error occurs.
-
close
void close()
Closes this provider when it is no longer used by the respective workspace and release resources bound by this provider.
-
isLive
boolean isLive()
Returnstrue, if this provider is still alive and able to evaluate permissions;falseotherwise.- Returns:
true, if this provider is still alive and able to evaluate permissions;falseotherwise.
-
getEffectivePolicies
AccessControlPolicy[] getEffectivePolicies(Path absPath, CompiledPermissions permissions) throws ItemNotFoundException, RepositoryException
Returns the effective policies for the node at the given absPath.- Parameters:
absPath- an absolute path.permissions- The effective permissions of the editing sessions that attempts to view the effective policies.- Returns:
- The effective policies that apply at
absPathor an empty array if the implementation cannot determine the effective policy at the given path. - Throws:
ItemNotFoundException- If no Node with the specifiedabsPathexists.RepositoryException- If another error occurs.- See Also:
AccessControlManager.getEffectivePolicies(String)
-
getEffectivePolicies
AccessControlPolicy[] getEffectivePolicies(Set<Principal> principals, CompiledPermissions permissions) throws RepositoryException
Returns the effective policies for the given principals.- Parameters:
principals- A set of principal.permissions- The effective permissions of the editing sessions that attempts to view the effective policies. @return The effective policies that are in effect for the givenprincipalor an empty array.- Throws:
RepositoryException- If error occurs.- See Also:
JackrabbitAccessControlManager.getEffectivePolicies(Set)
-
getEditor
AccessControlEditor getEditor(Session session) throws RepositoryException
Returns anAccessControlEditorfor the given Session object ornullif the implementation does not support editing of access control policies.- Parameters:
session- The editing session.- Returns:
- the ACL editor or
null. - Throws:
RepositoryException- If an error occurs.
-
compilePermissions
CompiledPermissions compilePermissions(Set<Principal> principals) throws RepositoryException
Compiles the effective policy for the specified set ofPrincipals.- Parameters:
principals- Set of principals to compile the permissions for. If the order of evaluating permissions for principals is meaningful, the caller should pass a Set that respects the order of insertion.- Returns:
- The effective, compiled CompiledPolicy that applies for the specified set of principals.
- Throws:
RepositoryException- If an error occurs.
-
canAccessRoot
boolean canAccessRoot(Set<Principal> principals) throws RepositoryException
Returnstrueif the given set of principals can access the root node of the workspace this provider has been built for;falseotherwise.- Parameters:
principals- Set of principals to be tested for being allowed to access the root node.- Returns:
trueif the given set of principals can access the root node of the workspace this provider has been built for;falseotherwise.- Throws:
RepositoryException- If an error occurs.
-
-