I'm trying to add (AD) groups to project roles using the Script Runner (5.04) Console, using Jira 7.3.1. I'm trying to use the method:
void addActorsToProjectRole(Collection<String> actors,
ProjectRole projectRole,
Project project,
String actorType,
ErrorCollection errorCollection)source:
https://docs.atlassian.com/jira/7.3.1/com/atlassian/jira/bc/projectroles/ProjectRoleService.html#addActorsToProjectRole-java.util.Collection-com.atlassian.jira.security.roles.ProjectRole-com.atlassian.jira.project.Project-java.lang.String-com.atlassian.jira.util.ErrorCollection-
import com.atlassian.jira.bc.projectroles.ProjectRoleService
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.security.roles.ProjectRole
import com.atlassian.jira.util.SimpleErrorCollection
import com.atlassian.jira.security.roles.ProjectRoleManager
import com.atlassian.jira.project.ProjectManager
import com.atlassian.jira.project.Project
def projectRoleService =ComponentAccessor.getComponent(ProjectRoleService);
def projectRoleManager =ComponentAccessor.getComponent(ProjectRoleManager);
def projectManager =ComponentAccessor.getComponent(ProjectManager);
ProjectRole projectRoleObject = projectRoleManager.getProjectRole("Role Name")
Project project = projectManager.getProjectObjByKey("XYZ")
def errorCollection = new SimpleErrorCollection();
projectRoleService.AddActorsToProjectRole(['Group A'], projectRoleObject, project, "GroupRoleActor.TYPE", errorCollection)
Static type checking errors are the issue. The problem lies with the errorCollection - I am also unable to use:
projectRoleManager.getProjectRoleActors(projectRoleObject, project, errorCollection)
Can anyone help?