info.magnolia.cms.security
Class RepositoryBackedSecurityManager

java.lang.Object
  extended by info.magnolia.cms.security.RepositoryBackedSecurityManager
Direct Known Subclasses:
MgnlGroupManager, MgnlRoleManager, MgnlUserManager

public abstract class RepositoryBackedSecurityManager
extends Object

Common parent class for repo based security managers.


Constructor Summary
RepositoryBackedSecurityManager()
           
 
Method Summary
protected  void add(String principalName, String resourceName, String resourceTypeName)
          Adds link to a resource (group or role) to the principal (user or group).
protected abstract  javax.jcr.Node findPrincipalNode(String principalName, javax.jcr.Session session)
           
protected  javax.jcr.Node findPrincipalNode(String principalName, javax.jcr.Session session, String primaryNodeType)
           
protected  javax.jcr.Node findPrincipalNode(String principalName, javax.jcr.Session session, String primaryNodeType, javax.jcr.Node startNode)
          Helper method to find principal node of type NodeTypes.User#NAME, NodeTypes.Group#NAME or NodeTypes.Role#NAME.
protected  Map<String,ACL> getACLs(javax.jcr.Node node)
           
 Map<String,ACL> getACLs(String principalName)
           
protected abstract  String getRepositoryName()
           
protected  String getResourceName(String resourceId)
           
 boolean hasAny(String principalName, String resourceName, String resourceTypeName)
           
protected  void remove(String principalName, String resourceName, String resourceTypeName)
          This call is lenient and will not throw exception in case principal doesn't exist! Instead it will simply return without making any change.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RepositoryBackedSecurityManager

public RepositoryBackedSecurityManager()
Method Detail

hasAny

public boolean hasAny(String principalName,
                      String resourceName,
                      String resourceTypeName)

add

protected void add(String principalName,
                   String resourceName,
                   String resourceTypeName)
            throws PrincipalNotFoundException
Adds link to a resource (group or role) to the principal (user or group). This call is lenient and will not throw exception in case principal doesn't exist! Instead it will simply return without making any change.

Parameters:
principalName - name of the user or group to be updated
resourceName - name of the group or role to be added
resourceTypeName - type of the added resource (group or role) #NODE_ROLES, #NODE_GROUPS
Throws:
PrincipalNotFoundException

getResourceName

protected String getResourceName(String resourceId)

remove

protected void remove(String principalName,
                      String resourceName,
                      String resourceTypeName)
               throws PrincipalNotFoundException
This call is lenient and will not throw exception in case principal doesn't exist! Instead it will simply return without making any change.

Parameters:
principalName - name of the user or group to be updated
resourceName - name of the group or role to be added
resourceTypeName - type of the added resource (group or role) #NODE_ROLES, #NODE_GROUPS
Throws:
PrincipalNotFoundException

getRepositoryName

protected abstract String getRepositoryName()

findPrincipalNode

protected abstract javax.jcr.Node findPrincipalNode(String principalName,
                                                    javax.jcr.Session session)
                                             throws javax.jcr.RepositoryException
Throws:
javax.jcr.RepositoryException

findPrincipalNode

protected javax.jcr.Node findPrincipalNode(String principalName,
                                           javax.jcr.Session session,
                                           String primaryNodeType)
                                    throws javax.jcr.RepositoryException
Throws:
javax.jcr.RepositoryException

findPrincipalNode

protected javax.jcr.Node findPrincipalNode(String principalName,
                                           javax.jcr.Session session,
                                           String primaryNodeType,
                                           javax.jcr.Node startNode)
                                    throws javax.jcr.RepositoryException
Helper method to find principal node of type NodeTypes.User#NAME, NodeTypes.Group#NAME or NodeTypes.Role#NAME. Not using JCR queries as they require an updated index, which might not been given, i.e. during installation of a module (bootstrapped resources).

Throws:
javax.jcr.RepositoryException

getACLs

public Map<String,ACL> getACLs(String principalName)

getACLs

protected Map<String,ACL> getACLs(javax.jcr.Node node)
                           throws javax.jcr.RepositoryException,
                                  javax.jcr.ValueFormatException,
                                  javax.jcr.PathNotFoundException
Throws:
javax.jcr.RepositoryException
javax.jcr.ValueFormatException
javax.jcr.PathNotFoundException


Copyright © 2003-2014 Magnolia International Ltd.. All Rights Reserved.