com.sas.hls.security.group
Interface GroupService


public interface GroupService

Service that provides methods to manage lifecycle of a group within SAS Drug Development.

A group is a collection of principals (users or other groups) and may be identified by a name and context. Group is associated with and scoped to a context where it is defined. Group contexts are objects that are implement the GroupContext interface. See GroupContext. Examples of group contexts are Organization, Project and Analysis.


Method Summary
 Group createGroup(GroupContext groupContext, String groupName, String groupDescription, Set<Principal> members)
          Create a new group.
 void deleteGroup(GroupDescriptor groupDescriptor)
          Delete a group.
 Set<GroupDescriptor> getAllGroupsByMember(Principal member)
          Get all groups that have the specified principal as a member.
 Set<GroupDescriptor> getAllReachableGroupsByMember(Principal member)
          Returns a set of all reachable groups.
 Group getGroup(GroupDescriptor groupDescriptor)
          Get the client representation of a group given its descriptor.
 Group getGroupByIdentifier(String identifier)
          Get the client representation of a group given its identifier.
 Group getGroupByName(GroupContext groupContext, String name)
          Get the client representation of a group given its name and context..
 GroupDescriptor getGroupDescriptorByIdentifier(String identifier)
          Get the light-weight representation of a group given its identifier.
 Set<GroupDescriptor> getGroupDescriptors(GroupContext groupContext)
          Get the light-weight representation of all groups defined in a given context
 Set<GroupDescriptor> getGroupDescriptorsByIdentifiers(Set<String> identifiers)
          Get the light-weight representation of a group given its identifier.
 Set<Group> getGroups(GroupContext groupContext)
          Get all the groups defined in a given context
 Set<Group> getGroupsByIdentifiers(Set<String> identifiers)
          Get all the groups specified by the list of identifiers
 Set<GroupDescriptor> getGroupsByMember(GroupContext groupContext, Principal member)
          Get all groups in a given context that have the specified principal as a member.
 Set<GroupDescriptor> getReachableGroupsByMember(GroupContext groupContext, Principal member)
          Returns a set of all reachable groups in the specified context.
 boolean groupExists(GroupContext groupContext, String name)
          Does a group exist?
 void removeFromGroupContextGroups(GroupContext groupContext, Set<Principal> members)
          Remove the specified members from all groups in a specific context.
 void removeFromGroups(Principal member)
          Remove the specified member from all groups.
 Group updateGroup(Group group)
          Update the definition of an existing group.
 

Method Detail

createGroup

Group createGroup(GroupContext groupContext,
                  String groupName,
                  String groupDescription,
                  Set<Principal> members)
                  throws GroupContextNotFoundException,
                         GroupExistsException,
                         InvalidGroupMemberException
Create a new group.

Parameters:
groupContext - The context of the group
groupName - The name of the group.
groupDescription - Description of this group.
members - The members of this group.
Returns:
The newly created group.
Throws:
GroupContextNotFoundException - The specified context could not be found.
GroupExistsException - A group by this name already exists in the provided context.
InvalidGroupMemberException - Thrown when a group is updated with new members that violate any membership contracts.

updateGroup

Group updateGroup(Group group)
                  throws GroupNotFoundException,
                         GroupExistsException,
                         InvalidGroupMemberException
Update the definition of an existing group.

Parameters:
group - the group to update
Returns:
the updated group
Throws:
GroupNotFoundException - The group could not be found on the server.
GroupExistsException - When a new name specified in the update request already exists for the context
InvalidGroupMemberException - Thrown when a group is updated with new members that violate any membership contracts.

deleteGroup

void deleteGroup(GroupDescriptor groupDescriptor)
                 throws GroupNotFoundException
Delete a group.

Parameters:
groupDescriptor - the group to delete
Throws:
GroupNotFoundException - Thrown when the group to be deleted could not be found.

removeFromGroups

void removeFromGroups(Principal member)
Remove the specified member from all groups.

Parameters:
member - the member to remove from all groups.

removeFromGroupContextGroups

void removeFromGroupContextGroups(GroupContext groupContext,
                                  Set<Principal> members)
Remove the specified members from all groups in a specific context.

Parameters:
groupContext - The context of the groups that should be modified.
members - The members to remove from those modified groups.

groupExists

boolean groupExists(GroupContext groupContext,
                    String name)
Does a group exist?

Parameters:
groupContext - The context of the group.
name - The name of the group.
Returns:
boolean value indicating if such a group is defined.

getGroup

Group getGroup(GroupDescriptor groupDescriptor)
               throws GroupNotFoundException
Get the client representation of a group given its descriptor.

Parameters:
groupDescriptor - the descriptor of the desired group.
Returns:
the group.
Throws:
GroupNotFoundException - The specified group could not be found.

getGroupByIdentifier

Group getGroupByIdentifier(String identifier)
                           throws GroupNotFoundException
Get the client representation of a group given its identifier.

Parameters:
identifier - the identifier of the desired group.
Returns:
the group
Throws:
GroupNotFoundException - The specified group could not be found.

getGroupByName

Group getGroupByName(GroupContext groupContext,
                     String name)
                     throws GroupNotFoundException
Get the client representation of a group given its name and context..

Parameters:
groupContext - the context of the group
name - the name of the group
Returns:
the group
Throws:
GroupNotFoundException - The specified group could not be found.

getGroupDescriptorByIdentifier

GroupDescriptor getGroupDescriptorByIdentifier(String identifier)
                                               throws GroupNotFoundException
Get the light-weight representation of a group given its identifier.

Parameters:
identifier - the identifier of the desired group
Returns:
the group
Throws:
GroupNotFoundException - The specified group could not be found.

getGroupDescriptorsByIdentifiers

Set<GroupDescriptor> getGroupDescriptorsByIdentifiers(Set<String> identifiers)
Get the light-weight representation of a group given its identifier.

Parameters:
identifiers - the identifiers of the desired groups
Returns:
the groups found.

getGroups

Set<Group> getGroups(GroupContext groupContext)
Get all the groups defined in a given context

Parameters:
groupContext - the context of the desired groups
Returns:
the set of all groups defined in that context

getGroupDescriptors

Set<GroupDescriptor> getGroupDescriptors(GroupContext groupContext)
Get the light-weight representation of all groups defined in a given context

Parameters:
groupContext - the context of the desired groups
Returns:
the set of all groupDescriptors defined in that context

getGroupsByIdentifiers

Set<Group> getGroupsByIdentifiers(Set<String> identifiers)
Get all the groups specified by the list of identifiers

Parameters:
identifiers - the identifiers of the desired groups
Returns:
the set of desired groups that could be found

getAllGroupsByMember

Set<GroupDescriptor> getAllGroupsByMember(Principal member)
Get all groups that have the specified principal as a member.

Parameters:
member - the principal in question
Returns:
the set of all groups that have the specified principal as a member.

getGroupsByMember

Set<GroupDescriptor> getGroupsByMember(GroupContext groupContext,
                                       Principal member)
                                       throws GroupContextNotFoundException
Get all groups in a given context that have the specified principal as a member.

Parameters:
groupContext - the context to search
member - the principal in question
Returns:
the set of all groups in that context that have the specified principal as a member.
Throws:
GroupContextNotFoundException - Thrown when the specified context could not be found.

getAllReachableGroupsByMember

Set<GroupDescriptor> getAllReachableGroupsByMember(Principal member)
Returns a set of all reachable groups.

Reachable groups are the directly assigned groups plus all groups that are (transitively) reachable from them in the group hierarchy.

Example:
Group hierarchy: GROUP_A > GROUP_B and GROUP_B > GROUP_C.

Directly assigned authority: GROUP_A.
Reachable authorities: GROUP_A, GROUP_B, GROUP_C.

Parameters:
member - the principal in question
Returns:
the set of all reachable groups that the member is a member of

getReachableGroupsByMember

Set<GroupDescriptor> getReachableGroupsByMember(GroupContext groupContext,
                                                Principal member)
Returns a set of all reachable groups in the specified context.

Reachable groups are the directly assigned groups plus all groups that are (transitively) reachable from them in the group hierarchy.

Parameters:
groupContext - the context to search
member - the principal in question
Returns:
the set of reachable groups in the specified context that the member is a member of


Copyright (c) 2013, SAS Institute Inc., Cary, NC, USA