public interface GroupService
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.
Modifier and Type | Method and Description |
---|---|
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.
|
GroupDescriptor |
getGroupDescriptorByName(GroupContext groupContext,
String name)
Get the light-weight representation of a group given its name and context.
|
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?
|
boolean |
isMember(String identifier,
Principal member)
Deprecated.
As of Java API 1.8. Replaced with
isMember(String, Principal, boolean) . |
boolean |
isMember(String identifier,
Principal member,
boolean includeImplicit)
Test to see if a given principal is member of the group, using the group identifier specified.
|
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.
|
Group createGroup(GroupContext groupContext, String groupName, String groupDescription, Set<Principal> members) throws GroupContextNotFoundException, GroupExistsException, InvalidGroupMemberException
groupContext
- The context of the groupgroupName
- The name of the group.groupDescription
- Description of this group.members
- The members of this group.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.Group updateGroup(Group group) throws GroupNotFoundException, GroupExistsException, InvalidGroupMemberException
group
- the group to updateGroupNotFoundException
- The group could not be found on the server.GroupExistsException
- When a new name specified in the update request already exists for the contextInvalidGroupMemberException
- Thrown when a group is updated with new members that violate any membership
contracts.void deleteGroup(GroupDescriptor groupDescriptor) throws GroupNotFoundException
groupDescriptor
- the group to deleteGroupNotFoundException
- Thrown when the group to be deleted could not be found.void removeFromGroups(Principal member)
member
- the member to remove from all groups.void removeFromGroupContextGroups(GroupContext groupContext, Set<Principal> members)
groupContext
- The context of the groups that should be modified.members
- The members to remove from those modified groups.boolean groupExists(GroupContext groupContext, String name)
groupContext
- The context of the group.name
- The name of the group.@Deprecated boolean isMember(String identifier, Principal member)
isMember(String, Principal, boolean)
.
This method will return true
if the principal is an explicit member or false
if the principal is
not a member, the group does not exist, or the principal does not exist. This check will retrieve the group with
the group identifier specified and see if the principal is an explicit member (it does NOT check any sub groups
for membership).
identifier
- the identifier of the group to check.member
- the principal to check.boolean isMember(String identifier, Principal member, boolean includeImplicit)
If specify false for includeImplicit, this method will return true
if the principal is an explicit member
or false
if the principal is not a member, the group does not exist, or the principal does not exist.
If specify true for includeImplicit, it will check for explicit membership as well as any sub groups
for membership.
identifier
- the identifier of the group to check.member
- the principal to check.includeImplicit
- true if membership checking should include implicit memberships through nested
groups, false if this should be an explicit membership only.Group getGroup(GroupDescriptor groupDescriptor) throws GroupNotFoundException
groupDescriptor
- the descriptor of the desired group.GroupNotFoundException
- The specified group could not be found.Group getGroupByIdentifier(String identifier) throws GroupNotFoundException
identifier
- the identifier of the desired group.GroupNotFoundException
- The specified group could not be found.Group getGroupByName(GroupContext groupContext, String name) throws GroupNotFoundException
groupContext
- the context of the groupname
- the name of the groupGroupNotFoundException
- The specified group could not be found.GroupDescriptor getGroupDescriptorByIdentifier(String identifier) throws GroupNotFoundException
identifier
- the identifier of the desired groupGroupNotFoundException
- The specified group could not be found.GroupDescriptor getGroupDescriptorByName(GroupContext groupContext, String name) throws GroupNotFoundException
groupContext
- the context of the groupname
- the name of the groupGroupNotFoundException
- The specified group could not be found.Set<GroupDescriptor> getGroupDescriptorsByIdentifiers(Set<String> identifiers)
identifiers
- the identifiers of the desired groupsSet<Group> getGroups(GroupContext groupContext)
groupContext
- the context of the desired groupsSet<GroupDescriptor> getGroupDescriptors(GroupContext groupContext)
groupContext
- the context of the desired groupsSet<Group> getGroupsByIdentifiers(Set<String> identifiers)
identifiers
- the identifiers of the desired groupsSet<GroupDescriptor> getAllGroupsByMember(Principal member)
member
- the principal in questionSet<GroupDescriptor> getGroupsByMember(GroupContext groupContext, Principal member) throws GroupContextNotFoundException
groupContext
- the context to searchmember
- the principal in questionGroupContextNotFoundException
- Thrown when the specified context could not be found.Set<GroupDescriptor> getAllReachableGroupsByMember(Principal member)
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.
member
- the principal in questionSet<GroupDescriptor> getReachableGroupsByMember(GroupContext groupContext, Principal member)
Reachable groups are the directly assigned groups plus all groups that are (transitively) reachable from them in the group hierarchy.
groupContext
- the context to searchmember
- the principal in questionCopyright (c) 2017, SAS Institute Inc., Cary, NC, USA