public interface GroupManager
| Modifier and Type | Method and Description |
|---|---|
void |
addUserToGroup(com.atlassian.crowd.embedded.api.User user,
com.atlassian.crowd.embedded.api.Group group)
Adds a user as a member of a group.
|
com.atlassian.crowd.embedded.api.Group |
createGroup(String groupName)
Create a group with the given name.
|
Collection<com.atlassian.crowd.embedded.api.Group> |
getAllGroups()
Get all groups.
|
Collection<com.atlassian.crowd.embedded.api.User> |
getDirectUsersInGroup(com.atlassian.crowd.embedded.api.Group group)
Returns all the users that are direct members of the group.
|
com.atlassian.crowd.embedded.api.Group |
getGroup(String groupName)
Returns the Group for this groupName, else null if no such Group exists.
|
com.atlassian.crowd.embedded.api.Group |
getGroupEvenWhenUnknown(String groupName)
Returns the Group for this groupName, if no such Group exists then a proxy unknown immutable Group object is
returned.
|
Collection<String> |
getGroupNamesForUser(ApplicationUser user)
Returns the names of all the groups that the given user belongs to.
|
Collection<String> |
getGroupNamesForUser(String userName)
Returns the names of all the groups that the given user belongs to.
|
Collection<String> |
getGroupNamesForUser(com.atlassian.crowd.embedded.api.User user)
Returns the names of all the groups that the given user belongs to.
|
com.atlassian.crowd.embedded.api.Group |
getGroupObject(String groupName)
Returns the Group for this groupName, else null if no such Group exists.
|
Collection<com.atlassian.crowd.embedded.api.Group> |
getGroupsForUser(String userName)
Returns all the groups that the given user belongs to.
|
Collection<com.atlassian.crowd.embedded.api.Group> |
getGroupsForUser(com.atlassian.crowd.embedded.api.User userName)
Returns all the groups that the given user belongs to.
|
Collection<String> |
getUserNamesInGroup(com.atlassian.crowd.embedded.api.Group group)
Returns the names of all the users in a group.
|
Collection<String> |
getUserNamesInGroup(String groupName)
Returns the names of all the users in a group.
|
Collection<com.atlassian.crowd.embedded.api.User> |
getUsersInGroup(com.atlassian.crowd.embedded.api.Group group)
Returns all the users in a group.
|
Collection<com.atlassian.crowd.embedded.api.User> |
getUsersInGroup(String groupName)
Returns all the users in a group.
|
boolean |
groupExists(String groupName)
Returns
true if the given group name exists. |
boolean |
isUserInGroup(String username,
String groupname)
Returns
true if the user is a member of the group. |
boolean |
isUserInGroup(com.atlassian.crowd.embedded.api.User user,
com.atlassian.crowd.embedded.api.Group group)
Returns
true if the user is a member of the group. |
boolean |
isUserInGroup(com.atlassian.crowd.embedded.api.User user,
String groupName)
Returns
true if the user is a member of the named group. |
boolean groupExists(String groupName)
true if the given group name exists.groupName - The group name.true if the given group name exists.Collection<com.atlassian.crowd.embedded.api.Group> getAllGroups()
com.atlassian.crowd.embedded.api.Group createGroup(String groupName) throws com.atlassian.crowd.exception.OperationNotPermittedException, com.atlassian.crowd.exception.embedded.InvalidGroupException
groupName - The group name.com.atlassian.crowd.exception.embedded.InvalidGroupException - if the group already exists in ANY associated directory or the group template does not have the required properties populated.com.atlassian.crowd.exception.OperationNotPermittedException - if the directory has been configured to not allow the operation to be performedcom.atlassian.crowd.embedded.api.Group getGroup(String groupName)
groupName - The group name.com.atlassian.crowd.embedded.api.Group getGroupEvenWhenUnknown(String groupName)
groupName - The group name.com.atlassian.crowd.embedded.api.Group getGroupObject(String groupName)
getGroup(String).groupName - The group name.getGroup(String)boolean isUserInGroup(String username, String groupname)
true if the user is a member of the group.
Note that if the username or groupname is null, then it will return false.
If you have a full User object, then calling one of the other isUserInGroup() methods is more efficient.
username - user to inspect.groupname - group to inspect.true if and only if the user is a direct or indirect (nested) member of the group.isUserInGroup(User, Group),
isUserInGroup(User, String)boolean isUserInGroup(com.atlassian.crowd.embedded.api.User user,
com.atlassian.crowd.embedded.api.Group group)
true if the user is a member of the group.
Note that if the User or Group object is null, then it will return false. This was done to retain consistency with the old OSUser behaviour of User.inGroup() and Group.containsUser()
user - user to inspect.group - group to inspect.true if and only if the user is a direct or indirect (nested) member of the group.isUserInGroup(String, String)boolean isUserInGroup(com.atlassian.crowd.embedded.api.User user,
String groupName)
true if the user is a member of the named group.
If you already have the User object, then this method is faster than the alternative of passing in the username because it saves on an unnecessary user lookup to find the correct User Directory.
user - user to inspect.groupName - group to inspect.true if and only if the user is a direct or indirect (nested) member of the group.isUserInGroup(User, Group)Collection<com.atlassian.crowd.embedded.api.User> getUsersInGroup(String groupName)
groupName - The group#getUsersInGroup(Group)}Collection<com.atlassian.crowd.embedded.api.User> getUsersInGroup(com.atlassian.crowd.embedded.api.Group group)
group - The groupNullPointerException - if the group is null#getUsersInGroup(String)}Collection<String> getUserNamesInGroup(com.atlassian.crowd.embedded.api.Group group)
group - The groupNullPointerException - if the group is null#getUsersInGroup(Group)}Collection<String> getUserNamesInGroup(String groupName)
groupName - The groupNullPointerException - if the group is null#getUsersInGroup(String)}Collection<com.atlassian.crowd.embedded.api.User> getDirectUsersInGroup(com.atlassian.crowd.embedded.api.Group group)
group - The groupNullPointerException - if the group is null#getUsersInGroup(String)}Collection<com.atlassian.crowd.embedded.api.Group> getGroupsForUser(String userName)
userName - The usergetGroupNamesForUser(String)Collection<com.atlassian.crowd.embedded.api.Group> getGroupsForUser(com.atlassian.crowd.embedded.api.User userName)
userName - The usergetGroupNamesForUser(String)Collection<String> getGroupNamesForUser(String userName)
userName - The usergetGroupsForUser(String),
getGroupNamesForUser(com.atlassian.jira.user.ApplicationUser)Collection<String> getGroupNamesForUser(com.atlassian.crowd.embedded.api.User user)
user - The usergetGroupsForUser(String)Collection<String> getGroupNamesForUser(ApplicationUser user)
user - The usergetGroupsForUser(String)void addUserToGroup(com.atlassian.crowd.embedded.api.User user,
com.atlassian.crowd.embedded.api.Group group)
throws com.atlassian.crowd.exception.GroupNotFoundException,
com.atlassian.crowd.exception.UserNotFoundException,
com.atlassian.crowd.exception.OperationNotPermittedException,
com.atlassian.crowd.exception.OperationFailedException
user - The user that will become a member of the group.group - The group that will gain a new member.com.atlassian.crowd.exception.UserNotFoundException - if the user could not be foundcom.atlassian.crowd.exception.GroupNotFoundException - if the group could not be foundcom.atlassian.crowd.exception.OperationNotPermittedException - if the directory has been configured to not allow the operation to be performedcom.atlassian.crowd.exception.OperationFailedException - If the underlying directory implementation failed to execute the operation.Copyright © 2002-2015 Atlassian. All Rights Reserved.