org.apache.jetspeed.security.impl
Class GroupManagerImpl

java.lang.Object
  extended by org.apache.jetspeed.security.impl.GroupManagerImpl
All Implemented Interfaces:
GroupManager

public class GroupManagerImpl
extends java.lang.Object
implements GroupManager

Describes the service interface for managing groups.

Group hierarchy elements are being returned as a Groupcollection. The backing implementation must appropriately map the group hierarchy to a preferences sub-tree.

The convention {principal}.{subprincipal} has been chosen to name groups hierachies. Implementation follow the conventions enforced by the PreferencesAPI.

Author:
David Le Strat , David Sean Taylor

Constructor Summary
GroupManagerImpl(SecurityProvider securityProvider)
           
 
Method Summary
 void addGroup(java.lang.String groupFullPathName)
           Add a new group.
 void addUserToGroup(java.lang.String username, java.lang.String groupFullPathName)
           Add a user to a group.
 Group getGroup(java.lang.String groupFullPathName)
           Get a group Groupfor a given group full path name.
 java.util.Iterator getGroups(java.lang.String filter)
          Get all groups available from all group handlers
 java.util.Collection getGroupsForUser(java.lang.String username)
           A collection of Groupfor all the groups associated to a specific user.
 java.util.Collection getGroupsInRole(java.lang.String roleFullPathName)
           A collection of Groupfor all the groups in a specific role.
 boolean groupExists(java.lang.String groupFullPathName)
           Whether or not a group exists.
 boolean isUserInGroup(java.lang.String username, java.lang.String groupFullPathName)
           Whether or not a user is in a group.
 void removeGroup(java.lang.String groupFullPathName)
           Remove a group.
 void removeUserFromGroup(java.lang.String username, java.lang.String groupFullPathName)
           Remove a user from a group.
 void setGroupEnabled(java.lang.String groupFullPathName, boolean enabled)
          Enable or disable a group.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GroupManagerImpl

public GroupManagerImpl(SecurityProvider securityProvider)
Parameters:
securityProvider - The security provider.
Method Detail

addGroup

public void addGroup(java.lang.String groupFullPathName)
              throws SecurityException
Description copied from interface: GroupManager

Add a new group.

Group principal names are expressed as {principal}.{subprincipal} where "." is the separator expressing the hierarchical nature of a group.

Group principal path names are stored leveraging the Preferences api. Groups will be stored under /group/theGroupName/theGroupNameChild when given the full path name theGroupName.theGroupNameChild.

Specified by:
addGroup in interface GroupManager
Parameters:
groupFullPathName - The group name full path (e.g. theGroupName.theGroupNameChild).
Throws:
SecurityException
See Also:
GroupManager.addGroup(java.lang.String)

removeGroup

public void removeGroup(java.lang.String groupFullPathName)
                 throws SecurityException
Description copied from interface: GroupManager

Remove a group.

Group principal names are expressed as {principal}.{subprincipal} where "." is the separator expressing the hierarchical nature of a group.

Group principal path names are stored leveraging the Preferences api. Groups will be stored under /group/theGroupName/theGroupNameChild when given the full path name theGroupName.theGroupNameChild.

Specified by:
removeGroup in interface GroupManager
Parameters:
groupFullPathName - The group name full path (e.g. theGroupName.theGroupNameChild)
Throws:
SecurityException
See Also:
GroupManager.removeGroup(java.lang.String)

groupExists

public boolean groupExists(java.lang.String groupFullPathName)
Description copied from interface: GroupManager

Whether or not a group exists.

Specified by:
groupExists in interface GroupManager
Parameters:
groupFullPathName - The group name full path (e.g. theGroupName.theGroupNameChild)
Returns:
Whether or not a group exists.
See Also:
GroupManager.groupExists(java.lang.String)

getGroup

public Group getGroup(java.lang.String groupFullPathName)
               throws SecurityException
Description copied from interface: GroupManager

Get a group Groupfor a given group full path name.

Specified by:
getGroup in interface GroupManager
Parameters:
groupFullPathName - The group name full path (e.g. theGroupName.theGroupChildName).
Returns:
The Preferencesnode.
Throws:
SecurityException
See Also:
GroupManager.getGroup(java.lang.String)

getGroupsForUser

public java.util.Collection getGroupsForUser(java.lang.String username)
                                      throws SecurityException
Description copied from interface: GroupManager

A collection of Groupfor all the groups associated to a specific user.

Specified by:
getGroupsForUser in interface GroupManager
Parameters:
username - The user name.
Returns:
A collection of Group.
Throws:
SecurityException
See Also:
GroupManager.getGroupsForUser(java.lang.String)

getGroupsInRole

public java.util.Collection getGroupsInRole(java.lang.String roleFullPathName)
                                     throws SecurityException
Description copied from interface: GroupManager

A collection of Groupfor all the groups in a specific role.

Specified by:
getGroupsInRole in interface GroupManager
Parameters:
roleFullPathName - The role full path (e.g. theRoleName.theRoleChildName)..
Returns:
A Collection of Group.
Throws:
SecurityException
See Also:
GroupManager.getGroupsInRole(java.lang.String)

addUserToGroup

public void addUserToGroup(java.lang.String username,
                           java.lang.String groupFullPathName)
                    throws SecurityException
Description copied from interface: GroupManager

Add a user to a group.

Specified by:
addUserToGroup in interface GroupManager
Parameters:
username - The user name.
groupFullPathName - The group name full path (e.g. theGroupName.theGroupChildName).
Throws:
SecurityException
See Also:
GroupManager.addUserToGroup(java.lang.String, java.lang.String)

removeUserFromGroup

public void removeUserFromGroup(java.lang.String username,
                                java.lang.String groupFullPathName)
                         throws SecurityException
Description copied from interface: GroupManager

Remove a user from a group.

Specified by:
removeUserFromGroup in interface GroupManager
Parameters:
username - The user name.
groupFullPathName - The group name full path (e.g. theGroupName.theGroupChildName).
Throws:
SecurityException
See Also:
GroupManager.removeUserFromGroup(java.lang.String, java.lang.String)

isUserInGroup

public boolean isUserInGroup(java.lang.String username,
                             java.lang.String groupFullPathName)
                      throws SecurityException
Description copied from interface: GroupManager

Whether or not a user is in a group.

Specified by:
isUserInGroup in interface GroupManager
Parameters:
username - The user name.
groupFullPathName - The group name full path (e.g. theGroupName.theGroupChildName).
Returns:
Whether or not a user is in a group.
Throws:
SecurityException
See Also:
GroupManager.isUserInGroup(java.lang.String, java.lang.String)

getGroups

public java.util.Iterator getGroups(java.lang.String filter)
                             throws SecurityException
Description copied from interface: GroupManager
Get all groups available from all group handlers

Specified by:
getGroups in interface GroupManager
Parameters:
filter - The filter used to retrieve matching groups.
Returns:
all groups available as Principal
Throws:
SecurityException
See Also:
GroupManager.getGroups(java.lang.String)

setGroupEnabled

public void setGroupEnabled(java.lang.String groupFullPathName,
                            boolean enabled)
                     throws SecurityException
Description copied from interface: GroupManager
Enable or disable a group.

Specified by:
setGroupEnabled in interface GroupManager
Parameters:
groupFullPathName - The group name full path theGroupName.theGroupChildName).
enabled - enabled flag for the group
Throws:
SecurityException
See Also:
GroupManager.setGroupEnabled(java.lang.String, boolean)


Copyright © 1999-2010 Apache Software Foundation. All Rights Reserved.