com.atlassian.jira.bc.group
Interface GroupService

All Known Implementing Classes:
DefaultGroupService

public interface GroupService

GroupService contains methods for managing Group's in JIRA.

Since:
v3.12

Nested Class Summary
static class GroupService.BulkEditGroupValidationResult
          This class is used for a return type for edit group validation.
 
Method Summary
 boolean addUsersToGroups(JiraServiceContext jiraServiceContext, java.util.Collection groupsToJoin, java.util.Collection userNames)
          This method will add the provided users to the specified groups.
 boolean areOnlyGroupsGrantingUserAdminPermissions(JiraServiceContext jiraServiceContext, java.util.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, java.lang.String groupName, java.lang.String swapGroup)
          This will delete a group from JIRA.
 long getCommentsAndWorklogsGuardedByGroupCount(java.lang.String groupName)
          This method will return the count of all Comment's and Worklog's that have the named group set as its visibility restriction.
 boolean isAdminDeletingSysAdminGroup(JiraServiceContext jiraServiceContext, java.lang.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 removeUsersFromGroups(JiraServiceContext jiraServiceContext, GroupRemoveUserMapper mapper)
          This method will remove the provided users from the specified groups.
 GroupService.BulkEditGroupValidationResult validateAddUsersToGroup(JiraServiceContext jiraServiceContext, java.util.Collection groupsToJoin, java.util.Collection 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, java.util.Collection groupsToJoin, java.lang.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, java.lang.String groupName, java.lang.String swapGroup)
          Validates if the group provided can be deleted in JIRA.
 boolean validateRemoveUserFromGroups(JiraServiceContext jiraServiceContext, java.util.List groupsToLeave, java.lang.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, GroupRemoveUserMapper 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).
 

Method Detail

validateDelete

boolean validateDelete(JiraServiceContext jiraServiceContext,
                       java.lang.String groupName,
                       java.lang.String swapGroup)
Validates if the group provided can be deleted in JIRA. If there are any problems deleting the group they will be reported in the error collection and the method will return false. Comment and worklogs visibility can be restricted by groups. If there are any associated comments or worklogs and a swap group is not provided then errors will be added to the error collection.

Parameters:
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 method
groupName - identifies the group to delete.
swapGroup - identifies the group to change comment and worklog visibility to.
Returns:
true if you can delete the group, false otherwise.
Since:
v3.12

delete

boolean delete(JiraServiceContext jiraServiceContext,
               java.lang.String groupName,
               java.lang.String swapGroup)
This will delete a group from JIRA. This method will remove the group from any notifications schemes, any associated permissions, and any associated project roles. This method will also update any 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.

Parameters:
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 method
groupName - identifies the group to delete.
swapGroup - identifies the group to change comment and worklog visibility to.
Returns:
true if the operation succeeds, false otherwise.
Since:
v3.12

validateAddUserToGroup

boolean validateAddUserToGroup(JiraServiceContext jiraServiceContext,
                               java.util.Collection groupsToJoin,
                               java.lang.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). If there are any problems with adding the user to the groups this method will return false and the error will be reported in the errorCollection. 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.

Parameters:
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 method
groupsToJoin - 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.
Returns:
true if you can successfully add the user to the groups, false otherwise.
Since:
v3.12

validateAddUsersToGroup

GroupService.BulkEditGroupValidationResult validateAddUsersToGroup(JiraServiceContext jiraServiceContext,
                                                                   java.util.Collection groupsToJoin,
                                                                   java.util.Collection 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). If there are any problems with adding the users to the groups this method will returns an unsuccessful result and the errors will be reported in the errorCollection. 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.

Parameters:
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 method
groupsToJoin - 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.
Returns:
a 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.getInvalidUsers() method will contain the usernames that were not valid to add to the groups.
Since:
v3.12

addUsersToGroups

boolean addUsersToGroups(JiraServiceContext jiraServiceContext,
                         java.util.Collection groupsToJoin,
                         java.util.Collection userNames)
This method will add the provided users to the specified groups. It is assumed that either 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.

Parameters:
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 method
groupsToJoin - 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.
Returns:
true if the operation succeeds, false otherwise.

validateRemoveUsersFromGroups

boolean validateRemoveUsersFromGroups(JiraServiceContext jiraServiceContext,
                                      GroupRemoveUserMapper 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). 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.

Parameters:
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 method
mapper - represents which users to remove from which groups.
Returns:
true only if the operation is valid.
Since:
v3.12

validateRemoveUserFromGroups

boolean validateRemoveUserFromGroups(JiraServiceContext jiraServiceContext,
                                     java.util.List groupsToLeave,
                                     java.lang.String userName)
Performs validation to see if the user can be removed from the groups by the current user (as specified in the jiraServiceContext). If there are any problems with removing the user 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 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.

Parameters:
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 method
groupsToLeave - the group names to remove the user from.
userName - the name of the user to remove from the groupsToLeave.
Returns:
true only if the operation is valid.
Since:
v3.12

removeUsersFromGroups

boolean removeUsersFromGroups(JiraServiceContext jiraServiceContext,
                              GroupRemoveUserMapper mapper)
This method will remove the provided users from the specified groups. It is assumed that either validateRemoveUsersFromGroups(com.atlassian.jira.bc.JiraServiceContext, GroupRemoveUserMapper) 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.

Parameters:
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 method
mapper - represents which users to remove from which groups.
Returns:
true if the operation succeeds, false otherwise.

getCommentsAndWorklogsGuardedByGroupCount

long getCommentsAndWorklogsGuardedByGroupCount(java.lang.String groupName)
This method will return the count of all Comment's and Worklog's that have the named group set as its visibility restriction.

Parameters:
groupName - identifies the group that the worklog or comments visibility is restricted by.
Returns:
the number of comments and worklogs that have their visibility restricted by the named group.
Since:
v3.12

areOnlyGroupsGrantingUserAdminPermissions

boolean areOnlyGroupsGrantingUserAdminPermissions(JiraServiceContext jiraServiceContext,
                                                  java.util.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.

Parameters:
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 method
groupNames - identifies the groups in question.
Returns:
true if the specified groups are the only ones granting the administrator rights, false otherwise.
Since:
v3.12

isAdminDeletingSysAdminGroup

boolean isAdminDeletingSysAdminGroup(JiraServiceContext jiraServiceContext,
                                     java.lang.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.

Parameters:
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 method
groupName - identifies the group in question.
Returns:
true if the current user is a JIRA Administrator and they are trying to delete a group that is associated with JIRA System Administrators, false otherwise.
Since:
v3.12


Copyright © 2002-2010 Atlassian. All Rights Reserved.