com.atlassian.crowd.service
Interface GroupMembershipManager

All Known Implementing Classes:
CachingGroupMembershipManager

public interface GroupMembershipManager

This interface allows applications to query relationships between users and groups.


Method Summary
 void addMembership(String userName, String groupName)
          Adds a user identified by userName to the group identified by groupName.
 List getMembers(String groupName)
          Obtains a list of all users in the group identified by groupName, sorted naturally.
 List getMemberships(String userName)
          Deprecated. Since 1.4
 boolean isMember(String userName, String groupName)
          Returns true if the user represented by userName is a member of groupName
 void removeMembership(String userName, String groupName)
          Removes a user identified by userName from the group identified by groupName.
 

Method Detail

isMember

boolean isMember(String userName,
                 String groupName)
                 throws RemoteException,
                        InvalidAuthorizationTokenException,
                        InvalidAuthenticationException
Returns true if the user represented by userName is a member of groupName

Parameters:
userName - The user to check
groupName - The group to check.
Returns:
true if a member, false otherwise.
Throws:
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 valid

addMembership

void addMembership(String userName,
                   String groupName)
                   throws RemoteException,
                          InvalidAuthorizationTokenException,
                          ApplicationPermissionException,
                          GroupNotFoundException,
                          UserNotFoundException,
                          InvalidAuthenticationException
Adds a user identified by userName to the group identified by groupName. If the user is already a member of the group, this method will return successfully.

Parameters:
userName - The user to add
groupName - The group the user will be added to
Throws:
RemoteException - A communication error occurred - the Crowd server may not be available.
InvalidAuthorizationTokenException - The application (not the user) was not authenticated correctly.
GroupNotFoundException - the group could not be found
UserNotFoundException - the user could not be found
ApplicationPermissionException - This application does not have permission to update group memberships.
InvalidAuthenticationException - application authentication is not valid

removeMembership

void removeMembership(String userName,
                      String groupName)
                      throws RemoteException,
                             InvalidAuthorizationTokenException,
                             ApplicationPermissionException,
                             GroupNotFoundException,
                             UserNotFoundException,
                             MembershipNotFoundException,
                             InvalidAuthenticationException
Removes a user identified by userName from the group identified by groupName. If the user was not a member of the group, this method will return successfully.

Parameters:
userName - The user to remove
groupName - The group the user will be added from
Throws:
RemoteException - A communication error occurred - the Crowd server may not be available.
InvalidAuthorizationTokenException - The application (not the user) was not authenticated correctly.
GroupNotFoundException - the group could not be found
UserNotFoundException - the user could not be found
ApplicationPermissionException - This application does not have permission to update group memberships.
InvalidAuthenticationException - application authentication is not valid
MembershipNotFoundException - Unable to find membership

getMemberships

List getMemberships(String userName)
                    throws RemoteException,
                           InvalidAuthorizationTokenException,
                           UserNotFoundException,
                           InvalidAuthenticationException
Deprecated. Since 1.4

Obtains a list of all groups that the user identified by userName belongs to, sorted naturally.

This can be a slow call, particularly on some LDAP directories, and so should be avoided. Use isMember() instead.

Parameters:
userName - The user whose group memberships are desired.
Returns:
A List of Strings containing all the groups the user belongs to, or an empty List
Throws:
RemoteException - A communication error occurred - the Crowd server may not be available.
InvalidAuthorizationTokenException - The application (not the user) was not authenticated correctly.
UserNotFoundException - If the user could not be found.
InvalidAuthenticationException - application authentication is not valid

getMembers

List getMembers(String groupName)
                throws RemoteException,
                       InvalidAuthorizationTokenException,
                       GroupNotFoundException,
                       InvalidAuthenticationException
Obtains a list of all users in the group identified by groupName, sorted naturally.

This is a fairly fast call, but implementers should still be using isMember() wherever practicable.

Parameters:
groupName - The group whose member users are desired.
Returns:
A List of Strings containing all the users in the group, or an empty list.
Throws:
RemoteException - A communication error occurred - the Crowd server may not be available.
InvalidAuthorizationTokenException - The application (not the user) was not authenticated correctly.
GroupNotFoundException - If the group could not be found.
InvalidAuthenticationException - application authentication is not valid


Copyright © 2012 Atlassian. All Rights Reserved.