public class CachingGroupMembershipManager extends Object implements GroupMembershipManager
Constructor and Description |
---|
CachingGroupMembershipManager(SecurityServerClient securityServerClient,
UserManager userManager,
GroupManager groupManager,
BasicCache basicCache) |
Modifier and Type | Method and Description |
---|---|
void |
addMembership(String userName,
String groupName)
Adds a user identified by
userName to the group identified by groupName . |
List |
getMembers(String groupName)
Also see
CachingGroupManager.getGroup(String) for very similar logic. |
List |
getMemberships(String userName)
Obtains a list of all groups that the user identified by
userName belongs to, sorted naturally. |
boolean |
isMember(String userName,
String groupName)
Returns true if the user represented by
userName is a member of groupName |
Boolean |
isUserOrGroup(String name) |
void |
removeMembership(String userName,
String groupName)
Removes a user identified by
userName from the group identified by groupName . |
public CachingGroupMembershipManager(SecurityServerClient securityServerClient, UserManager userManager, GroupManager groupManager, BasicCache basicCache)
public boolean isMember(String userName, String groupName) throws RemoteException, InvalidAuthorizationTokenException, InvalidAuthenticationException
GroupMembershipManager
userName
is a member of groupName
isMember
in interface GroupMembershipManager
userName
- The user to checkgroupName
- The group to check.RemoteException
- A communication error occurred - the Crowd server may not be available.InvalidAuthorizationTokenException
- The application (not the user) was not authenticated correctly.InvalidAuthenticationException
- application authentication is not validpublic void addMembership(String userName, String groupName) throws RemoteException, InvalidAuthorizationTokenException, ApplicationPermissionException, InvalidAuthenticationException, UserNotFoundException, GroupNotFoundException
GroupMembershipManager
userName
to the group identified by groupName
. If the user
is already a member of the group, this method will return successfully.addMembership
in interface GroupMembershipManager
userName
- The user to addgroupName
- The group the user will be added toRemoteException
- A communication error occurred - the Crowd server may not be available.InvalidAuthorizationTokenException
- The application (not the user) was not authenticated correctly.ApplicationPermissionException
- This application does not have permission to update group memberships.InvalidAuthenticationException
- application authentication is not validUserNotFoundException
- the user could not be foundGroupNotFoundException
- the group could not be foundpublic void removeMembership(String userName, String groupName) throws RemoteException, InvalidAuthorizationTokenException, ApplicationPermissionException, MembershipNotFoundException, UserNotFoundException, InvalidAuthenticationException, GroupNotFoundException
GroupMembershipManager
userName
from the group identified by groupName
. If the
user was not a member of the group, this method will return successfully.removeMembership
in interface GroupMembershipManager
userName
- The user to removegroupName
- The group the user will be added fromRemoteException
- A communication error occurred - the Crowd server may not be available.InvalidAuthorizationTokenException
- The application (not the user) was not authenticated correctly.ApplicationPermissionException
- This application does not have permission to update group memberships.MembershipNotFoundException
- Unable to find membershipUserNotFoundException
- the user could not be foundInvalidAuthenticationException
- application authentication is not validGroupNotFoundException
- the group could not be foundpublic List getMemberships(String userName) throws RemoteException, InvalidAuthorizationTokenException, InvalidAuthenticationException, UserNotFoundException
GroupMembershipManager
userName
belongs to, sorted naturally.
This can be a slow call, particularly on some LDAP directories, and so should be avoided. Use
isMember()
instead.
getMemberships
in interface GroupMembershipManager
userName
- The user whose group memberships are desired.List
of String
s containing all the groups the user belongs to, or an empty ListRemoteException
- A communication error occurred - the Crowd server may not be available.InvalidAuthorizationTokenException
- The application (not the user) was not authenticated correctly.InvalidAuthenticationException
- application authentication is not validUserNotFoundException
- If the user could not be found.public List getMembers(String groupName) throws RemoteException, InvalidAuthorizationTokenException, InvalidAuthenticationException, GroupNotFoundException
CachingGroupManager.getGroup(String)
for very similar logic.getMembers
in interface GroupMembershipManager
groupName
- The group whose member users are desired.List
of String
s containing all the users in the group, or an empty list.RemoteException
- A communication error occurred - the Crowd server may not be available.InvalidAuthorizationTokenException
- The application (not the user) was not authenticated correctly.InvalidAuthenticationException
- application authentication is not validGroupNotFoundException
- If the group could not be found.public Boolean isUserOrGroup(String name) throws InvalidAuthorizationTokenException, RemoteException, InvalidAuthenticationException
Copyright © 2021 Atlassian. All rights reserved.