public class DefaultGroupService extends Object implements GroupService
GroupService
.GroupService.BulkEditGroupValidationResult
Constructor and Description |
---|
DefaultGroupService(GlobalPermissionManager globalPermissionManager,
GlobalPermissionGroupAssociationUtil globalPermissionGroupAssociationUtil,
CommentManager commentManager,
WorklogManager worklogManager,
NotificationSchemeManager notificationSchemeManager,
PermissionManager permissionManager,
ProjectRoleService projectRoleService,
IssueSecurityLevelManager issueSecurityLevelManager,
UserUtil userUtil,
SharePermissionDeleteUtils sharePermissionDeleteUtils,
SubscriptionManager subscriptionManager,
com.atlassian.crowd.embedded.api.CrowdService crowdService,
JiraContactHelper jiraContactHelper,
GroupManager groupManager,
ApplicationRoleManager applicationRoleManager,
GroupsToApplicationsSeatingHelper groupsToApplicationsSeatingHelper) |
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). |
public DefaultGroupService(GlobalPermissionManager globalPermissionManager, GlobalPermissionGroupAssociationUtil globalPermissionGroupAssociationUtil, CommentManager commentManager, WorklogManager worklogManager, NotificationSchemeManager notificationSchemeManager, PermissionManager permissionManager, ProjectRoleService projectRoleService, IssueSecurityLevelManager issueSecurityLevelManager, UserUtil userUtil, SharePermissionDeleteUtils sharePermissionDeleteUtils, SubscriptionManager subscriptionManager, com.atlassian.crowd.embedded.api.CrowdService crowdService, JiraContactHelper jiraContactHelper, GroupManager groupManager, @Nonnull ApplicationRoleManager applicationRoleManager, GroupsToApplicationsSeatingHelper groupsToApplicationsSeatingHelper)
public boolean validateDelete(JiraServiceContext jiraServiceContext, String groupName, String swapGroup)
GroupService
validateDelete
in interface GroupService
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.public boolean delete(JiraServiceContext jiraServiceContext, String groupName, String swapGroup)
GroupService
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 GroupService.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.
delete
in interface GroupService
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.public boolean validateAddUserToGroup(JiraServiceContext jiraServiceContext, Collection<String> groupsToJoin, String userName)
GroupService
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.
validateAddUserToGroup
in interface GroupService
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.public GroupService.BulkEditGroupValidationResult validateAddUsersToGroup(JiraServiceContext jiraServiceContext, Collection<String> groupsToJoin, Collection<String> userNames)
GroupService
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.
validateAddUsersToGroup
in interface GroupService
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.public GroupService.BulkEditGroupValidationResult validateAddGroupsToGroup(JiraServiceContext jiraServiceContext, Collection<String> groupsToJoin, Collection<String> groupNames)
GroupService
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.
validateAddGroupsToGroup
in interface GroupService
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.public boolean addUsersToGroups(JiraServiceContext jiraServiceContext, Collection<String> groupsToJoin, Collection<String> userNames)
GroupService
GroupService.validateAddUsersToGroup(com.atlassian.jira.bc.JiraServiceContext, java.util.Collection, java.util.Collection)
or GroupService.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.addUsersToGroups
in interface GroupService
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.public boolean addGroupsToGroups(JiraServiceContext jiraServiceContext, Collection<String> groupsToJoin, Collection<String> childNames)
GroupService
GroupService.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.addGroupsToGroups
in interface GroupService
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.public boolean validateRemoveUserFromGroups(JiraServiceContext jiraServiceContext, List groupsToLeave, String userName)
GroupService
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.
validateRemoveUserFromGroups
in interface GroupService
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.public boolean validateRemoveUsersFromGroups(JiraServiceContext jiraServiceContext, GroupRemoveChildMapper mapper)
GroupService
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.
validateRemoveUsersFromGroups
in interface GroupService
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.public boolean validateRemoveGroupsFromGroups(JiraServiceContext jiraServiceContext, GroupRemoveChildMapper mapper)
GroupService
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.
validateRemoveGroupsFromGroups
in interface GroupService
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.public boolean removeUsersFromGroups(JiraServiceContext jiraServiceContext, GroupRemoveChildMapper mapper)
GroupService
GroupService.validateRemoveUsersFromGroups(com.atlassian.jira.bc.JiraServiceContext, GroupRemoveChildMapper)
or GroupService.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.removeUsersFromGroups
in interface GroupService
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.public boolean removeGroupsFromGroups(JiraServiceContext jiraServiceContext, GroupRemoveChildMapper mapper)
GroupService
GroupService.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.removeGroupsFromGroups
in interface GroupService
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.public long getCommentsAndWorklogsGuardedByGroupCount(String groupName)
GroupService
Comment
's and
Worklog
's that have the named group set as its
visibility restriction.getCommentsAndWorklogsGuardedByGroupCount
in interface GroupService
groupName
- identifies the group that the worklog or comments visibility is restricted by.public boolean areOnlyGroupsGrantingUserAdminPermissions(JiraServiceContext jiraServiceContext, Collection groupNames)
GroupService
Permissions.ADMINISTER
permissions.areOnlyGroupsGrantingUserAdminPermissions
in interface GroupService
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.public boolean isAdminDeletingSysAdminGroup(JiraServiceContext jiraServiceContext, String groupName)
GroupService
isAdminDeletingSysAdminGroup
in interface GroupService
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.public Collection<String> getChildGroupNames(com.atlassian.crowd.embedded.api.Group group)
GroupService
getChildGroupNames
in interface GroupService
group
- to search for.public Collection<String> getParentGroupNames(com.atlassian.crowd.embedded.api.Group group)
GroupService
getParentGroupNames
in interface GroupService
group
- to search for.Copyright © 2002-2018 Atlassian. All Rights Reserved.