public interface

GroupManager

com.atlassian.jira.security.groups.GroupManager
Known Indirect Subclasses

Class Overview

This object can be used to manage groups in JIRA.

Summary

Public Methods
void addUserToGroup(User user, Group group)
Adds a user as a member of a group.
Group createGroup(String groupName)
Create a group with the given name.
Collection<Group> getAllGroups()
Get all groups.
Collection<User> getDirectUsersInGroup(Group group)
Returns all the users that are direct members of the group.
Group getGroup(String groupName)
Returns the Group for this groupName, else null if no such Group exists.
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(String userName)
Returns the names of all the groups that the given user belongs to.
Collection<String> getGroupNamesForUser(ApplicationUser user)
Returns the names of all the groups that the given user belongs to.
Collection<String> getGroupNamesForUser(User user)
Returns the names of all the groups that the given user belongs to.
Group getGroupObject(String groupName)
Returns the Group for this groupName, else null if no such Group exists.
Collection<Group> getGroupsForUser(User userName)
Returns all the groups that the given user belongs to.
Collection<Group> getGroupsForUser(String userName)
Returns all the groups that the given user belongs to.
Collection<String> getUserNamesInGroup(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<User> getUsersInGroup(Group group)
Returns all the users in a group.
Collection<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(User user, Group group)
Returns true if the user is a member of the group.

Public Methods

public void addUserToGroup (User user, Group group)

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
UserNotFoundException if the user could not be found
GroupNotFoundException if the group could not be found
OperationNotPermittedException if the directory has been configured to not allow the operation to be performed
OperationFailedException If the underlying directory implementation failed to execute the operation.

public Group createGroup (String groupName)

Create a group with the given name.

Parameters
groupName The group name.
Returns
  • the newly created Group.
Throws
InvalidGroupException if the group already exists in ANY associated directory or the group template does not have the required properties populated.
OperationNotPermittedException if the directory has been configured to not allow the operation to be performed

public Collection<Group> getAllGroups ()

Get all groups.

Returns
  • Collection of all Groups.

public Collection<User> getDirectUsersInGroup (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
See Also
  • {@link #getUsersInGroup(String)}

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

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

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

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

public Collection<String> getGroupNamesForUser (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.

public 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

public Collection<Group> getGroupsForUser (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.

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

public Collection<String> getUserNamesInGroup (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
See Also
  • {@link #getUsersInGroup(Group)}

public 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
See Also
  • {@link #getUsersInGroup(String)}

public Collection<User> getUsersInGroup (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
See Also
  • {@link #getUsersInGroup(String)}

public Collection<User> getUsersInGroup (String groupName)

Returns all the users in a group.

Parameters
groupName The group
Returns
  • all the users that belongs to the group.
See Also
  • {@link #getUsersInGroup(Group)}

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

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

public boolean isUserInGroup (User user, 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.