@PublicApi
public interface GroupService
Group
's in JIRA.Modifier and Type | Interface and Description |
---|---|
static class |
GroupService.BulkEditGroupValidationResult
This class is used for a return type for edit group validation.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addGroupsToGroups(JiraServiceContext jiraServiceContext,
Collection<String> groupsToJoin,
Collection<String> childNames)
This method will add the provided groups to the specified groups.
|
boolean |
addUsersToGroups(JiraServiceContext jiraServiceContext,
Collection<String> groupsToJoin,
Collection<String> userNames)
This method will add the provided users to the specified groups.
|
boolean |
areOnlyGroupsGrantingUserAdminPermissions(JiraServiceContext jiraServiceContext,
Collection groupNames)
This is a validation utility method that will determine if the specified groups are the only groups that are
granting the current user their
Permissions.ADMINISTER permissions. |
boolean |
delete(JiraServiceContext jiraServiceContext,
String groupName,
String swapGroup)
This will delete a group from JIRA.
|
Collection<String> |
getChildGroupNames(com.atlassian.crowd.embedded.api.Group group)
Return the name of groups that are members of this Group.
|
long |
getCommentsAndWorklogsGuardedByGroupCount(String groupName)
|
Collection<String> |
getParentGroupNames(com.atlassian.crowd.embedded.api.Group group)
Return the name of groups that are parents of this Group.
|
boolean |
isAdminDeletingSysAdminGroup(JiraServiceContext jiraServiceContext,
String groupName)
This is a validation utility method that will determine if the current user is only a JIRA Administrator
and they are trying to delete a group that is associated with JIRA System Administrators.
|
boolean |
removeGroupsFromGroups(JiraServiceContext jiraServiceContext,
GroupRemoveChildMapper mapper)
This method will remove the provided child groups from the specified groups.
|
boolean |
removeUsersFromGroups(JiraServiceContext jiraServiceContext,
GroupRemoveChildMapper mapper)
This method will remove the provided users from the specified groups.
|
GroupService.BulkEditGroupValidationResult |
validateAddGroupsToGroup(JiraServiceContext jiraServiceContext,
Collection<String> groupsToJoin,
Collection<String> groupNames)
Performs validation to see if the provided groups (identified by the groupNames collection) can be added to the
provided group by the current user (as specified in the jiraServiceContext).
|
GroupService.BulkEditGroupValidationResult |
validateAddUsersToGroup(JiraServiceContext jiraServiceContext,
Collection<String> groupsToJoin,
Collection<String> userNames)
Performs validation to see if the provided users (identified by the userNames collection) can be added to the
provided group by the current user (as specified in the jiraServiceContext).
|
boolean |
validateAddUserToGroup(JiraServiceContext jiraServiceContext,
Collection<String> groupsToJoin,
String userName)
Performs validation to see if the provided user (identified by username) can be added to the provided group
by the current user (as specified in the jiraServiceContext).
|
boolean |
validateDelete(JiraServiceContext jiraServiceContext,
String groupName,
String swapGroup)
Validates if the group provided can be deleted in JIRA.
|
boolean |
validateRemoveGroupsFromGroups(JiraServiceContext jiraServiceContext,
GroupRemoveChildMapper mapper)
Performs validation to see if the groups identified in
mapper can be removed from
their respective groups by the current user (as specified in the jiraServiceContext). |
boolean |
validateRemoveUserFromGroups(JiraServiceContext jiraServiceContext,
List groupsToLeave,
String userName)
Performs validation to see if the user can be removed from the groups by the current user (as specified in
the jiraServiceContext).
|
boolean |
validateRemoveUsersFromGroups(JiraServiceContext jiraServiceContext,
GroupRemoveChildMapper mapper)
Performs validation to see if the users identified in
mapper can be removed from
their respective groups by the current user (as specified in the jiraServiceContext). |
boolean validateDelete(JiraServiceContext jiraServiceContext, String groupName, String swapGroup)
jiraServiceContext
- containing the user who the permission checks will be run against (can be null,
indicating an anonymous user) and the errorCollection that will contain any errors in calling the methodgroupName
- identifies the group to delete.swapGroup
- identifies the group to change comment and worklog visibility to.boolean delete(JiraServiceContext jiraServiceContext, String groupName, String swapGroup)
Comment
's and Worklog
's
that have visibility restrictions set to the current group such that their restrictions will be changed to
the swapGroup.
This method assumes that the validateDelete(com.atlassian.jira.bc.JiraServiceContext, String, String)
method has been called and that it did not generate any errors.
You must have Permissions.ADMINISTER
permissions or higher to invoke this
method.
jiraServiceContext
- containing the user who the permission checks will be run against (can be null,
indicating an anonymous user) and the errorCollection that will contain any errors in calling the methodgroupName
- identifies the group to delete.swapGroup
- identifies the group to change comment and worklog visibility to.boolean validateAddUserToGroup(JiraServiceContext jiraServiceContext, Collection<String> groupsToJoin, String userName)
The operation will not be valid if external user management is enabled, the groups or user does not exist, the user is already a member of all the groups, or the current user does not have permission to add the user to the groups.
jiraServiceContext
- containing the user who the permission checks will be run against (can be null,
indicating an anonymous user) and the errorCollection that will contain any errors in calling the methodgroupsToJoin
- a collection of String
's that represent groupNames that the user should be added to.
This must not be null.userName
- identifies the user to be added to the groups, must not be null.GroupService.BulkEditGroupValidationResult validateAddUsersToGroup(JiraServiceContext jiraServiceContext, Collection<String> groupsToJoin, Collection<String> userNames)
The operation will not be valid if external user management is enabled, the groups or user does not exist, the user is already a member of the groups, or the current user does not have permission to add the user to the groups.
jiraServiceContext
- containing the user who the permission checks will be run against (can be null,
indicating an anonymous user) and the errorCollection that will contain any errors in calling the methodgroupsToJoin
- a collection of String
's that represent groupNames that the user should be added to.
This must not be null.userNames
- collection of String
userNames that identifies the users to be added to the groups,
must not be null.GroupService.BulkEditGroupValidationResult
which if the users
can be added to the groups will have isSuccess be true. Otherwise isSuccess will be false and if there was
any problem validating the users to add the
GroupService.BulkEditGroupValidationResult.getInvalidChildren()
method will
contain the usernames that were not valid to add to the groups.GroupService.BulkEditGroupValidationResult validateAddGroupsToGroup(JiraServiceContext jiraServiceContext, Collection<String> groupsToJoin, Collection<String> groupNames)
The operation will not be valid if external user management is enabled, the parent or child groups do not exist, the child is already a member of the groups, or the current user does not have permission to add the group to the groups.
jiraServiceContext
- containing the user who the permission checks will be run against (can be null,
indicating an anonymous user) and the errorCollection that will contain any errors in calling the methodgroupsToJoin
- a collection of String
's that represent groupNames that the user should be added to.
This must not be null.groupNames
- collection of String
groupNames that identifies the groups to be added to the groups,
must not be null.GroupService.BulkEditGroupValidationResult
which if the groups
can be added to the groups will have isSuccess be true. Otherwise isSuccess will be false and if there was
any problem validating the users to add the
GroupService.BulkEditGroupValidationResult.getInvalidChildren()
method will
contain the groups that were not valid to add to the groups.boolean addUsersToGroups(JiraServiceContext jiraServiceContext, Collection<String> groupsToJoin, Collection<String> userNames)
validateAddUsersToGroup(com.atlassian.jira.bc.JiraServiceContext, java.util.Collection, java.util.Collection)
or validateAddUserToGroup(com.atlassian.jira.bc.JiraServiceContext, java.util.Collection, String)
has
been called and not returned any errors. This method will not perform any validation other than simple
permissions checks.jiraServiceContext
- containing the user who the permission checks will be run against (can be null,
indicating an anonymous user) and the errorCollection that will contain any errors in calling the methodgroupsToJoin
- a collection of String
's that represent groupNames that the user should be added to.
This must not be null.userNames
- collection of String
userNames that identifies the users to be added to the groups,
must not be null.boolean addGroupsToGroups(JiraServiceContext jiraServiceContext, Collection<String> groupsToJoin, Collection<String> childNames)
validateAddGroupsToGroup(com.atlassian.jira.bc.JiraServiceContext, java.util.Collection, java.util.Collection)
has been called and not returned any errors. This method will not perform any validation other than simple
permissions checks.jiraServiceContext
- containing the user who the permission checks will be run against (can be null,
indicating an anonymous user) and the errorCollection that will contain any errors in calling the methodgroupsToJoin
- a collection of String
's that represent groupNames that the child group should be added to.
This must not be null.childNames
- collection of String
childNames that identifies the child groups to be added to the groups,
must not be null.boolean validateRemoveUsersFromGroups(JiraServiceContext jiraServiceContext, GroupRemoveChildMapper mapper)
mapper
can be removed from
their respective groups by the current user (as specified in the jiraServiceContext). If there are any problems with
removing the users from the groups this method will return false and the errors will be reported in the errorCollection.
The operation will not be valid if external user management is enabled, the groups or users do not exist, the user is not currently a member of the groups, or the current user does not have permission to remove the users from the groups.
jiraServiceContext
- containing the user who the permission checks will be run against (can be null,
indicating an anonymous user) and the errorCollection that will contain any errors in calling the methodmapper
- represents which users to remove from which groups.boolean validateRemoveGroupsFromGroups(JiraServiceContext jiraServiceContext, GroupRemoveChildMapper mapper)
mapper
can be removed from
their respective groups by the current user (as specified in the jiraServiceContext). If there are any problems with
removing the groups from the groups this method will return false and the errors will be reported in the errorCollection.
The operation will not be valid if external user management is enabled, the parent or child groups do not exist, the group is not currently a member of the groups, or the current user does not have permission to remove the groups from the groups.
jiraServiceContext
- containing the user who the permission checks will be run against (can be null,
indicating an anonymous user) and the errorCollection that will contain any errors in calling the methodmapper
- represents which groups to remove from which groups.boolean validateRemoveUserFromGroups(JiraServiceContext jiraServiceContext, List groupsToLeave, String userName)
The operation will not be valid if external user management is enabled, the groups or user does not exist, the user is not currently a member of the groups, or the current user does not have permission to remove the user from the groups.
jiraServiceContext
- containing the user who the permission checks will be run against (can be null,
indicating an anonymous user) and the errorCollection that will contain any errors in calling the methodgroupsToLeave
- the group names to remove the user from.userName
- the name of the user to remove from the groupsToLeave.boolean removeUsersFromGroups(JiraServiceContext jiraServiceContext, GroupRemoveChildMapper mapper)
validateRemoveUsersFromGroups(com.atlassian.jira.bc.JiraServiceContext, GroupRemoveChildMapper)
or validateRemoveUserFromGroups(com.atlassian.jira.bc.JiraServiceContext, java.util.List, String)
been called and not returned any errors. This method will not perform any validation other than simple
permissions checks.jiraServiceContext
- containing the user who the permission checks will be run against (can be null,
indicating an anonymous user) and the errorCollection that will contain any errors in calling the methodmapper
- represents which users to remove from which groups.boolean removeGroupsFromGroups(JiraServiceContext jiraServiceContext, GroupRemoveChildMapper mapper)
validateRemoveGroupsFromGroups(com.atlassian.jira.bc.JiraServiceContext, GroupRemoveChildMapper)
has been called and not returned any errors. This method will not perform any validation other than simple
permissions checks.jiraServiceContext
- containing the user who the permission checks will be run against (can be null,
indicating an anonymous user) and the errorCollection that will contain any errors in calling the methodmapper
- represents which child groups to remove from which groups.long getCommentsAndWorklogsGuardedByGroupCount(String groupName)
Comment
's and
Worklog
's that have the named group set as its
visibility restriction.groupName
- identifies the group that the worklog or comments visibility is restricted by.boolean areOnlyGroupsGrantingUserAdminPermissions(JiraServiceContext jiraServiceContext, Collection groupNames)
Permissions.ADMINISTER
permissions.jiraServiceContext
- containing the user who the permission checks will be run against (can be null,
indicating an anonymous user) and the errorCollection that will contain any errors in calling the methodgroupNames
- identifies the groups in question.boolean isAdminDeletingSysAdminGroup(JiraServiceContext jiraServiceContext, String groupName)
jiraServiceContext
- containing the user who the permission checks will be run against (can be null,
indicating an anonymous user) and the errorCollection that will contain any errors in calling the methodgroupName
- identifies the group in question.Collection<String> getChildGroupNames(com.atlassian.crowd.embedded.api.Group group)
group
- to search for.Collection<String> getParentGroupNames(com.atlassian.crowd.embedded.api.Group group)
group
- to search for.Copyright © 2002-2021 Atlassian. All Rights Reserved.