Class RequestCachingGroupManager
java.lang.Object
com.atlassian.jira.security.groups.RequestCachingGroupManager
- All Implemented Interfaces:
GroupManager
This class is wrapper around
DefaultGroupManager which adds request caching
functionality around some of its methods. When methods of this class are called outside of request scope all calls
will simply get delegated to underlying DefaultGroupManager.- Since:
- v7.0.1
-
Constructor Summary
ConstructorsConstructorDescriptionRequestCachingGroupManager(DefaultGroupManager defaultGroupManager, RequestCacheFactory requestCacheFactory) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddUserToGroup(ApplicationUser user, com.atlassian.crowd.embedded.api.Group group) Adds a user as a member of a group.com.atlassian.crowd.embedded.api.GroupcreateGroup(String groupName) Create a group with the given name.filterUsersInAllGroupsDirect(Collection<String> userNames, Collection<String> groupNames) Returns a collection of user names for the users that are direct members of every one of the supplied groups.Returns the names of all groups or an empty collection if there are no groups.Collection<com.atlassian.crowd.embedded.api.Group> Get all groups.Deprecated.getDirectUsersInGroup(com.atlassian.crowd.embedded.api.Group group) Returns all the users that are direct members of the group.com.atlassian.crowd.embedded.api.GroupReturns the Group for this groupName, else null if no such Group exists.com.atlassian.crowd.embedded.api.GroupgetGroupEvenWhenUnknown(String groupName) Returns the Group for this groupName, if no such Group exists then a proxy unknown immutable Group object is returned.Returns the names of all the groups that the given user belongs to.getGroupNamesForUser(String userName) Returns the names of all the groups that the given user belongs to.com.atlassian.crowd.embedded.api.GroupgetGroupObject(String groupName) Returns the Group for this groupName, else null if no such Group exists.Collection<com.atlassian.crowd.embedded.api.Group> Returns all the groups that the given user belongs to.Collection<com.atlassian.crowd.embedded.api.Group> getGroupsForUser(String userName) Returns all the groups that the given user belongs to.getNamesOfDirectMembersOfGroups(Collection<String> groupNames, int limit) Returns a list of all active user names that are direct members in at least one of the supplied groups.getUserNamesInGroup(com.atlassian.crowd.embedded.api.Group group) Returns the names of all the users in a group.getUserNamesInGroup(String groupName) Returns the names of all the users in a group.getUserNamesInGroups(Collection<com.atlassian.crowd.embedded.api.Group> groups) Returns the names of all the users in a collection of groups.getUsersInGroup(com.atlassian.crowd.embedded.api.Group group) Returns all the users in a group.getUsersInGroup(String groupName) Returns all the users in a group.getUsersInGroup(String groupName, Boolean includeInactive) Returns all the users in a group.getUsersInGroup(String groupName, Boolean includeInactive, PageRequest pageRequest) Returns a page with users in a group.intgetUsersInGroupCount(com.atlassian.crowd.embedded.api.Group group) Returns a count of all active users in a group.intgetUsersInGroupCount(String groupName) Returns a count of all active users in a group.booleangroupExists(com.atlassian.crowd.embedded.api.Group group) Returnstrueif the given group exists.booleangroupExists(String groupName) Returnstrueif the given group name exists.booleanisUserInGroup(ApplicationUser user, com.atlassian.crowd.embedded.api.Group group) Returnstrueif the user is a member of the group.booleanisUserInGroup(ApplicationUser user, String groupName) Returnstrueif the user is a member of the named group.booleanisUserInGroup(String username, String groupname) Returnstrueif the user is a member of the group.booleanisUserInGroups(ApplicationUser user, Set<String> groupNames) Returnstrueif the user is a member of at least one of the named groups.
-
Constructor Details
-
RequestCachingGroupManager
public RequestCachingGroupManager(DefaultGroupManager defaultGroupManager, RequestCacheFactory requestCacheFactory)
-
-
Method Details
-
groupExists
Description copied from interface:GroupManagerReturnstrueif the given group name exists.- Specified by:
groupExistsin interfaceGroupManager- Parameters:
groupName- The group name.- Returns:
trueif the given group name exists.
-
groupExists
public boolean groupExists(@Nonnull com.atlassian.crowd.embedded.api.Group group) Description copied from interface:GroupManagerReturnstrueif the given group exists.- Specified by:
groupExistsin interfaceGroupManager- Parameters:
group- The group.- Returns:
trueif the given group exists.
-
getAllGroups
Description copied from interface:GroupManagerGet all groups.- Specified by:
getAllGroupsin interfaceGroupManager- Returns:
- Collection of all Groups.
-
createGroup
public com.atlassian.crowd.embedded.api.Group createGroup(String groupName) throws com.atlassian.crowd.exception.OperationNotPermittedException, com.atlassian.crowd.exception.embedded.InvalidGroupException Description copied from interface:GroupManagerCreate a group with the given name.- Specified by:
createGroupin interfaceGroupManager- Parameters:
groupName- The group name.- Returns:
- the newly created Group.
- Throws:
com.atlassian.crowd.exception.OperationNotPermittedException- if the directory has been configured to not allow the operation to be performedcom.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.
-
getGroup
Description copied from interface:GroupManagerReturns the Group for this groupName, else null if no such Group exists.- Specified by:
getGroupin interfaceGroupManager- Parameters:
groupName- The group name.- Returns:
- The Group for this groupName, else null if no such Group exists.
-
getGroupEvenWhenUnknown
Description copied from interface:GroupManagerReturns the Group for this groupName, if no such Group exists then a proxy unknown immutable Group object is returned.- Specified by:
getGroupEvenWhenUnknownin interfaceGroupManager- Parameters:
groupName- The group name.- Returns:
- The Group for this groupName.
-
getGroupObject
Description copied from interface:GroupManagerReturns the Group for this groupName, else null if no such Group exists.Legacy synonym for
GroupManager.getGroup(String).- Specified by:
getGroupObjectin interfaceGroupManager- Parameters:
groupName- The group name.- Returns:
- The Group for this groupName, else null if no such Group exists.
- See Also:
-
isUserInGroup
Description copied from interface:GroupManagerReturnstrueif the user is a member of the group.Note that if the username or groupname is null, then it will return false.
Performance note: If you have a full user object, then calling one of the other
isUserInGroup()methods directly is more efficient.- Specified by:
isUserInGroupin interfaceGroupManager- Parameters:
username- user to inspect.groupname- group to inspect.- Returns:
trueif and only if the user is a direct or indirect (nested) member of the group.- See Also:
-
isUserInGroup
Description copied from interface:GroupManagerReturnstrueif 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()
- Specified by:
isUserInGroupin interfaceGroupManager- Parameters:
user- user to inspect.group- group to inspect.- Returns:
trueif and only if the user is a direct or indirect (nested) member of the group.
-
isUserInGroup
Description copied from interface:GroupManagerReturnstrueif 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.
- Specified by:
isUserInGroupin interfaceGroupManager- Parameters:
user- user to inspect.groupName- group to inspect.- Returns:
trueif and only if the user is a direct or indirect (nested) member of the group.
-
isUserInGroups
Description copied from interface:GroupManagerReturnstrueif the user is a member of at least one of the named groups.- Specified by:
isUserInGroupsin interfaceGroupManager- Parameters:
user- user to inspect.groupNames- groups to inspect.- Returns:
trueif and only if the user is a direct or indirect (nested) member of the groups.
-
getUsersInGroup
Description copied from interface:GroupManagerReturns all the users in a group.- Specified by:
getUsersInGroupin interfaceGroupManager- Parameters:
groupName- The group- Returns:
- all the users that belongs to the group.
-
getUsersInGroup
Description copied from interface:GroupManagerReturns all the users in a group. Allows for additional filtering by the active flag of a user.- Specified by:
getUsersInGroupin interfaceGroupManager- Parameters:
groupName- The groupincludeInactive- if set to true inactive users will be returned as well- Returns:
- all the users that belongs to the group.
-
getUsersInGroup
public Page<ApplicationUser> getUsersInGroup(String groupName, Boolean includeInactive, PageRequest pageRequest) Description copied from interface:GroupManagerReturns a page with users in a group. Users are sorted by name in ascending order.- Specified by:
getUsersInGroupin interfaceGroupManager- Parameters:
groupName- name of the group for which users are returnedincludeInactive- if set to true inactive users will be returned as wellpageRequest- parameters of the page to return- Returns:
- page with the users
-
getUsersInGroup
Description copied from interface:GroupManagerReturns all the users in a group. This will include nested group members.- Specified by:
getUsersInGroupin interfaceGroupManager- Parameters:
group- The group- Returns:
- all the users that belongs to the group.
-
getUsersInGroupCount
public int getUsersInGroupCount(com.atlassian.crowd.embedded.api.Group group) Description copied from interface:GroupManagerReturns a count of all active users in a group. This will include nested group members.- Specified by:
getUsersInGroupCountin interfaceGroupManager- Parameters:
group- The group- Returns:
- a count of all the users that belongs to the group.
-
getUsersInGroupCount
Description copied from interface:GroupManagerReturns a count of all active users in a group. This will include nested group members.- Specified by:
getUsersInGroupCountin interfaceGroupManager- Parameters:
groupName- The group name- Returns:
- a count of all the users that belongs to the group.
-
getNamesOfDirectMembersOfGroups
Description copied from interface:GroupManagerReturns a list of all active user names that are direct members in at least one of the supplied groups.- Specified by:
getNamesOfDirectMembersOfGroupsin interfaceGroupManager- Parameters:
groupNames- A collection of group names to find direct members oflimit- A maximum number of names to return- Returns:
- a list of user names
-
filterUsersInAllGroupsDirect
public Collection<String> filterUsersInAllGroupsDirect(Collection<String> userNames, Collection<String> groupNames) Description copied from interface:GroupManagerReturns a collection of user names for the users that are direct members of every one of the supplied groups.- Specified by:
filterUsersInAllGroupsDirectin interfaceGroupManager- Parameters:
userNames- A collection of user namesgroupNames- A collection of groups- Returns:
- a collection of user names
-
getUserNamesInGroup
Description copied from interface:GroupManagerReturns the names of all the users in a group. This will include nested group members.- Specified by:
getUserNamesInGroupin interfaceGroupManager- Parameters:
group- The group- Returns:
- all the users that belongs to the group.
-
getUserNamesInGroups
public Collection<String> getUserNamesInGroups(Collection<com.atlassian.crowd.embedded.api.Group> groups) Description copied from interface:GroupManagerReturns the names of all the users in a collection of groups. This will include nested group members.- Specified by:
getUserNamesInGroupsin interfaceGroupManager- Parameters:
groups- The collection of groups- Returns:
- all the users that belongs to the group.
-
getUserNamesInGroup
Description copied from interface:GroupManagerReturns the names of all the users in a group. This will include nested group members.- Specified by:
getUserNamesInGroupin interfaceGroupManager- Parameters:
groupName- The group- Returns:
- all the users that belongs to the group.
-
getDirectUsersInGroup
public Collection<ApplicationUser> getDirectUsersInGroup(com.atlassian.crowd.embedded.api.Group group) Description copied from interface:GroupManagerReturns all the users that are direct members of the group. This will NOT include nested group members.- Specified by:
getDirectUsersInGroupin interfaceGroupManager- Parameters:
group- The group- Returns:
- all the users that belongs to the group.
-
getGroupsForUser
Description copied from interface:GroupManagerReturns all the groups that the given user belongs to.- Specified by:
getGroupsForUserin interfaceGroupManager- Parameters:
userName- The user- Returns:
- all the groups that the given user belongs to.
- See Also:
-
getGroupsForUser
public Collection<com.atlassian.crowd.embedded.api.Group> getGroupsForUser(@Nonnull ApplicationUser user) Description copied from interface:GroupManagerReturns all the groups that the given user belongs to.- Specified by:
getGroupsForUserin interfaceGroupManager- Parameters:
user- The user- Returns:
- all the groups that the given user belongs to.
- See Also:
-
getGroupNamesForUser
Description copied from interface:GroupManagerReturns the names of all the groups that the given user belongs to.- Specified by:
getGroupNamesForUserin interfaceGroupManager- Parameters:
userName- The user- Returns:
- all the groups that the given user belongs to.
- See Also:
-
getGroupNamesForUser
Description copied from interface:GroupManagerReturns the names of all the groups that the given user belongs to.- Specified by:
getGroupNamesForUserin interfaceGroupManager- Parameters:
user- The user- Returns:
- all the groups that the given user belongs to.
- See Also:
-
addUserToGroup
public void addUserToGroup(ApplicationUser 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 Description copied from interface:GroupManagerAdds a user as a member of a group.- Specified by:
addUserToGroupin interfaceGroupManager- 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.GroupNotFoundException- if thegroupcould not be foundcom.atlassian.crowd.exception.UserNotFoundException- if theusercould 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.
-
getConnectUsers
Deprecated.Description copied from interface:GroupManagerReturns all the connect app users. This will return an emptySetin JIRA Server as connect plugins are only supported in JIRA Cloud. This result does not filter out inactive users.- Specified by:
getConnectUsersin interfaceGroupManager- Returns:
- all the connect app users.
-
getAllGroupNames
Description copied from interface:GroupManagerReturns the names of all groups or an empty collection if there are no groups.- Specified by:
getAllGroupNamesin interfaceGroupManager- Returns:
- all the groups.
-