info.magnolia.cms.security
Class MgnlGroupManager

java.lang.Object
  extended by info.magnolia.cms.security.RepositoryBackedSecurityManager
      extended by info.magnolia.cms.security.MgnlGroupManager
All Implemented Interfaces:
GroupManager

public class MgnlGroupManager
extends RepositoryBackedSecurityManager
implements GroupManager

Group manager working directly with JCR API and returning simple groups (no JCR node aware).


Constructor Summary
MgnlGroupManager()
           
 
Method Summary
 Group addGroup(Group group, String groupName)
          Adds a group to a group.
 Group addRole(Group group, String roleName)
          Grants a role to a group.
 Group createGroup(String name)
          Creates a new group in the root folder.
 Group createGroup(String path, String name)
          Creates a new group in a specific folder.
protected  void findAllGroupsInFolder(javax.jcr.Node node, Collection<Group> groups)
          Finds all groups located in the provided node or in sub-folders within it.
protected  javax.jcr.Node findPrincipalNode(String principalName, javax.jcr.Session session)
          Helper method to find a group.
 Collection<Group> getAllGroups()
          Get all groups defined in the system.
 Collection<String> getAllGroups(String name)
          Get all groups related to one concrete group.
 Group getGroup(String name)
          Get a group by name.
protected  String getRepositoryName()
           
protected  Group newGroupInstance(javax.jcr.Node node)
           
protected  void validateGroupName(String name)
           
 
Methods inherited from class info.magnolia.cms.security.RepositoryBackedSecurityManager
add, findPrincipalNode, findPrincipalNode, getACLs, getACLs, getResourceName, hasAny, remove
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface info.magnolia.cms.security.GroupManager
getACLs
 

Constructor Detail

MgnlGroupManager

public MgnlGroupManager()
Method Detail

createGroup

public Group createGroup(String name)
                  throws AccessDeniedException
Description copied from interface: GroupManager
Creates a new group in the root folder.

Specified by:
createGroup in interface GroupManager
Throws:
AccessDeniedException

createGroup

public Group createGroup(String path,
                         String name)
                  throws AccessDeniedException
Creates a new group in a specific folder. The folder must exist.

Throws:
IllegalArgumentException - if the name is not valid or if a group with this name already exists
UnsupportedOperationException - if the implementation does not support writing
AccessDeniedException

getGroup

public Group getGroup(String name)
               throws AccessDeniedException
Description copied from interface: GroupManager
Get a group by name.

Specified by:
getGroup in interface GroupManager
Throws:
AccessDeniedException

getAllGroups

public Collection<Group> getAllGroups()
Description copied from interface: GroupManager
Get all groups defined in the system.

Specified by:
getAllGroups in interface GroupManager

getAllGroups

public Collection<String> getAllGroups(String name)
Description copied from interface: GroupManager
Get all groups related to one concrete group.

Specified by:
getAllGroups in interface GroupManager

newGroupInstance

protected Group newGroupInstance(javax.jcr.Node node)
                          throws javax.jcr.RepositoryException
Throws:
javax.jcr.RepositoryException

findPrincipalNode

protected javax.jcr.Node findPrincipalNode(String principalName,
                                           javax.jcr.Session session)
                                    throws javax.jcr.RepositoryException
Helper method to find a group. Uses JCR Query. This will return null if group doesn't exist.

Specified by:
findPrincipalNode in class RepositoryBackedSecurityManager
Throws:
javax.jcr.RepositoryException

getRepositoryName

protected String getRepositoryName()
Specified by:
getRepositoryName in class RepositoryBackedSecurityManager

addRole

public Group addRole(Group group,
                     String roleName)
              throws AccessDeniedException
Description copied from interface: GroupManager
Grants a role to a group.

Specified by:
addRole in interface GroupManager
Returns:
Group object with the role already granted.
Throws:
AccessDeniedException

addGroup

public Group addGroup(Group group,
                      String groupName)
               throws AccessDeniedException
Description copied from interface: GroupManager
Adds a group to a group.

Specified by:
addGroup in interface GroupManager
Returns:
group object with the group already assigned.
Throws:
AccessDeniedException

findAllGroupsInFolder

protected void findAllGroupsInFolder(javax.jcr.Node node,
                                     Collection<Group> groups)
                              throws javax.jcr.RepositoryException
Finds all groups located in the provided node or in sub-folders within it.

Throws:
javax.jcr.RepositoryException

validateGroupName

protected void validateGroupName(String name)
                          throws AccessDeniedException
Throws:
AccessDeniedException


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