com.atlassian.jira.security.groups
Interface GroupManager

All Known Implementing Classes:
DefaultGroupManager

public interface GroupManager

This object can be used to manage groups in JIRA. This manager offers the following advantages over using the Open Symphony UserManager class:

Since:
v3.13

Method Summary
 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.
 Group getGroup(String groupName)
          Deprecated. Use getGroupObject(String groupName) Since v4.3.
 Collection<String> getGroupNamesForUser(String userName)
          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.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(User user, Group group)
          Deprecated. Use isUserInGroup(com.atlassian.crowd.embedded.api.User, com.atlassian.crowd.embedded.api.Group) instead. Since v4.4.
 

Method Detail

groupExists

boolean groupExists(String groupName)
Returns true if the given group name exists.

Parameters:
groupName - The group name.
Returns:
true if the given group name exists.
Since:
v3.13

getAllGroups

Collection<com.atlassian.crowd.embedded.api.Group> getAllGroups()
Get all groups.

Returns:
Collection of all Groups.
Since:
v4.3

createGroup

com.atlassian.crowd.embedded.api.Group createGroup(String groupName)
                                                   throws com.atlassian.crowd.exception.OperationNotPermittedException,
                                                          com.atlassian.crowd.exception.embedded.InvalidGroupException
Create a group with the given name.

Parameters:
groupName - The group name.
Returns:
the newly created Group.
Throws:
com.atlassian.crowd.exception.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 performed
com.atlassian.crowd.exception.OperationFailedException - underlying directory implementation failed to execute the operation.
com.atlassian.crowd.exception.embedded.InvalidGroupException
Since:
v4.3

getGroup

Group getGroup(String groupName)
Deprecated. Use getGroupObject(String groupName) Since v4.3.

Returns the Group for this groupName, else null if no such Group exists.

Parameters:
groupName - The group name.
Returns:
The Group for this groupName, else null if no such Group exists.

getGroupObject

com.atlassian.crowd.embedded.api.Group getGroupObject(String groupName)
Returns the Group for this groupName, else null if no such Group exists.

Parameters:
groupName - The group name.
Returns:
The Group for this groupName, else null if no such Group exists.

isUserInGroup

boolean isUserInGroup(String username,
                      String groupname)
Returns true if the user is a member of the group.

Note that if the username or groupname is null, then it will return false.

Parameters:
username - user to inspect.
groupname - group to inspect.
Returns:
true if and only if the user is a direct or indirect (nested) member of the group.
See Also:
isUserInGroup(com.atlassian.crowd.embedded.api.User, com.atlassian.crowd.embedded.api.Group)

isUserInGroup

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.

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()

Parameters:
user - user to inspect.
group - group to inspect.
Returns:
true if and only if the user is a direct or indirect (nested) member of the group.
See Also:
isUserInGroup(String, String)

isUserInGroup

boolean isUserInGroup(User user,
                      Group group)
Deprecated. Use isUserInGroup(com.atlassian.crowd.embedded.api.User, com.atlassian.crowd.embedded.api.Group) instead. Since v4.4.

Returns 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()

Parameters:
user - user to inspect.
group - group to inspect.
Returns:
true if and only if the user is a direct or indirect (nested) member of the group.

getUsersInGroup

Collection<com.atlassian.crowd.embedded.api.User> getUsersInGroup(String groupName)
Returns all the users in a group.

Parameters:
groupName - The group
Returns:
all the users that belongs to the group.
Since:
v4.3
See Also:
#getUsersInGroup(Group)}

getUsersInGroup

Collection<com.atlassian.crowd.embedded.api.User> getUsersInGroup(com.atlassian.crowd.embedded.api.Group group)
Returns all the users in a group. This will include nested group members.

Parameters:
group - The group
Returns:
all the users that belongs to the group.
Throws:
NullPointerException - if the group is null
Since:
v4.3
See Also:
#getUsersInGroup(String)}

getDirectUsersInGroup

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. This will NOT include nested group members.

Parameters:
group - The group
Returns:
all the users that belongs to the group.
Throws:
NullPointerException - if the group is null
Since:
v4.3
See Also:
#getUsersInGroup(String)}

getGroupsForUser

Collection<com.atlassian.crowd.embedded.api.Group> getGroupsForUser(String userName)
Returns all the groups that the given user belongs to.

Parameters:
userName - The user
Returns:
all the groups that the given user belongs to.
Since:
v4.3
See Also:
getGroupNamesForUser(String)

getGroupNamesForUser

Collection<String> getGroupNamesForUser(String userName)
Returns the names of all the groups that the given user belongs to.

Parameters:
userName - The user
Returns:
all the groups that the given user belongs to.
Since:
v4.3
See Also:
getGroupsForUser(String)

addUserToGroup

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
Adds a user as a member of a group.

Parameters:
user - The user that will become a member of the group.
group - The group that will gain a new member.
Throws:
com.atlassian.crowd.exception.UserNotFoundException - if the user could not be found
com.atlassian.crowd.exception.GroupNotFoundException - if the group could not be found
com.atlassian.crowd.exception.OperationNotPermittedException - if the directory has been configured to not allow the operation to be performed
com.atlassian.crowd.exception.OperationFailedException - If the underlying directory implementation failed to execute the operation.
Since:
v4.3


Copyright © 2002-2011 Atlassian. All Rights Reserved.