com.atlassian.jira.security.groups
Interface GroupManager

All Known Implementing Classes:
DefaultGroupManager, MockGroupManager

public interface GroupManager

This object can be used to manage groups in JIRA.

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.
 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.
 

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.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 performed
Since:
v4.3

getGroup

com.atlassian.crowd.embedded.api.Group getGroup(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.

getGroupEvenWhenUnknown

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.

Parameters:
groupName - The group name.
Returns:
The Group for this groupName.

getGroupObject

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

Legacy synonym for getGroup(String).

Parameters:
groupName - The group name.
Returns:
The Group for this groupName, else null if no such Group exists.
See Also:
getGroup(String)

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)

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

getUserNamesInGroup

Collection<String> getUserNamesInGroup(com.atlassian.crowd.embedded.api.Group group)
Returns the names of 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:
v5.0
See Also:
#getUsersInGroup(Group)}

getUserNamesInGroup

Collection<String> getUserNamesInGroup(String groupName)
Returns the names of all the users in a group. This will include nested group members.

Parameters:
groupName - The group
Returns:
all the users that belongs to the group.
Throws:
NullPointerException - if the group is null
Since:
v5.0
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)

getGroupsForUser

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.

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), getGroupNamesForUser(com.atlassian.jira.user.ApplicationUser)

getGroupNamesForUser

Collection<String> getGroupNamesForUser(com.atlassian.crowd.embedded.api.User user)
Returns the names of all the groups that the given user belongs to.

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

getGroupNamesForUser

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

Parameters:
user - The user
Returns:
all the groups that the given user belongs to.
Since:
v6.2.5
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-2014 Atlassian. All Rights Reserved.