ModeShape Distribution 3.5.0.Final

org.modeshape.jcr
Class AccessControlManagerImpl

java.lang.Object
  extended by org.modeshape.jcr.AccessControlManagerImpl
All Implemented Interfaces:
AccessControlManager

public class AccessControlManagerImpl
extends Object
implements AccessControlManager

AccessControlManager implementation. AccessControlManager has been implemented suppose that node is associated with access control list which defines deny/allow actions for the given principal. Principals are transparent and can represent users or groups. ACLs are stored per node in a special child node called mode:acl. This node has a list of mode:{$principal_name} child nodes which has multi-value property permissions where permissions are defined by JCR specifications. {node} {mode:AccessControllable} +mode:acl{mode:Acl} +user-name{mode:permission} -permissions {String} To make node access controllable ModeShape adds "mode:AccessControllable" type to mixin types of the node. Access list related nodes are defined as protected do disallow normal add/remove/save item methods. Access list defined for the node also has affect on all child nodes unless child node defines its own Access list. Empty ACL means all permissions. Initially the default access list is assigned to the root node with all permissions granted to everyone. Access Control Manager implementation does not break any existing mechanism of authentications. It acts as an abstract secondary resource control feature. On the first stage one of the existing security acts and if it grants permission the ACL is asked to check permissions.


Constructor Summary
protected AccessControlManagerImpl(JcrSession session)
           
 
Method Summary
 JcrAccessControlList findAccessList(String absPath)
          Recursively searches for the available access list.
 AccessControlPolicyIterator getApplicablePolicies(String path)
           
 AccessControlPolicy[] getEffectivePolicies(String path)
           
 AccessControlPolicy[] getPolicies(String path)
           
 Privilege[] getPrivileges(String path)
           
 Privilege[] getSupportedPrivileges(String path)
           
 boolean hasPermission(Path absPath, String... actions)
           
 boolean hasPrivileges(String path, Privilege[] privileges)
           
 Privilege privilegeFromName(String name)
           
 Privilege[] privileges()
          Gets full list of known and supported privileges irrespective of the path.
 void removePolicy(String path, AccessControlPolicy policy)
           
 void setPolicy(String path, AccessControlPolicy policy)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AccessControlManagerImpl

protected AccessControlManagerImpl(JcrSession session)
Method Detail

privileges

public Privilege[] privileges()
Gets full list of known and supported privileges irrespective of the path.

Returns:
list of privileges.

getSupportedPrivileges

public Privilege[] getSupportedPrivileges(String path)
Specified by:
getSupportedPrivileges in interface AccessControlManager

privilegeFromName

public Privilege privilegeFromName(String name)
                            throws AccessControlException,
                                   RepositoryException
Specified by:
privilegeFromName in interface AccessControlManager
Throws:
AccessControlException
RepositoryException

hasPrivileges

public boolean hasPrivileges(String path,
                             Privilege[] privileges)
                      throws PathNotFoundException,
                             RepositoryException
Specified by:
hasPrivileges in interface AccessControlManager
Throws:
PathNotFoundException
RepositoryException

getPrivileges

public Privilege[] getPrivileges(String path)
                          throws PathNotFoundException,
                                 RepositoryException
Specified by:
getPrivileges in interface AccessControlManager
Throws:
PathNotFoundException
RepositoryException

getPolicies

public AccessControlPolicy[] getPolicies(String path)
                                  throws PathNotFoundException,
                                         AccessDeniedException,
                                         RepositoryException
Specified by:
getPolicies in interface AccessControlManager
Throws:
PathNotFoundException
AccessDeniedException
RepositoryException

getEffectivePolicies

public AccessControlPolicy[] getEffectivePolicies(String path)
                                           throws PathNotFoundException,
                                                  AccessDeniedException,
                                                  RepositoryException
Specified by:
getEffectivePolicies in interface AccessControlManager
Throws:
PathNotFoundException
AccessDeniedException
RepositoryException

getApplicablePolicies

public AccessControlPolicyIterator getApplicablePolicies(String path)
                                                  throws PathNotFoundException,
                                                         AccessDeniedException,
                                                         RepositoryException
Specified by:
getApplicablePolicies in interface AccessControlManager
Throws:
PathNotFoundException
AccessDeniedException
RepositoryException

setPolicy

public void setPolicy(String path,
                      AccessControlPolicy policy)
               throws PathNotFoundException,
                      AccessControlException,
                      AccessDeniedException,
                      LockException,
                      VersionException,
                      RepositoryException
Specified by:
setPolicy in interface AccessControlManager
Throws:
PathNotFoundException
AccessControlException
AccessDeniedException
LockException
VersionException
RepositoryException

removePolicy

public void removePolicy(String path,
                         AccessControlPolicy policy)
                  throws PathNotFoundException,
                         AccessControlException,
                         AccessDeniedException,
                         LockException,
                         VersionException,
                         RepositoryException
Specified by:
removePolicy in interface AccessControlManager
Throws:
PathNotFoundException
AccessControlException
AccessDeniedException
LockException
VersionException
RepositoryException

findAccessList

public JcrAccessControlList findAccessList(String absPath)
                                    throws PathNotFoundException,
                                           RepositoryException
Recursively searches for the available access list.

Parameters:
absPath - the absolute path of the node
Returns:
JCR defined access list object.
Throws:
PathNotFoundException
RepositoryException

hasPermission

public boolean hasPermission(Path absPath,
                             String... actions)

ModeShape Distribution 3.5.0.Final

Copyright © 2008-2013 JBoss, a division of Red Hat. All Rights Reserved.