I am trying to get all the administrators of the projects but I would like to get this in the table. There are several admins per project so I would like to make a table in which there would be several tables each covering the admins of each project
It is possible ?
import com.atlassian.jira.component.ComponentAccessorimport com.atlassian.jira.bc.projectroles.ProjectRoleService;import com.atlassian.jira.security.roles.ProjectRoleManager;import com.atlassian.jira.project.Project;import com.atlassian.jira.project.ProjectManager;import com.atlassian.jira.security.roles.ProjectRole;import com.atlassian.jira.security.roles.ProjectRoleActors;import com.atlassian.jira.util.ErrorCollection;import com.atlassian.jira.util.SimpleErrorCollection;import com.atlassian.jira.user.util.Usersdef sb = new StringBuffer()ProjectRoleService projectRoleService = (ProjectRoleService) ComponentAccessor.getComponentOfType(ProjectRoleService.class);ProjectRoleManager projectRoleManager = (ProjectRoleManager) ComponentAccessor.getComponentOfType(ProjectRoleManager.class);ProjectManager projectManager = ComponentAccessor.getProjectManager();ProjectRole administrator = projectRoleManager.getProjectRole("Administrators");ErrorCollection ec = new SimpleErrorCollection();//get all projectsprojectManager.getProjectObjects().each{
//get all project admins for that projectProjectRoleActors existingActors = projectRoleService.getProjectRoleActors(administrator,it,ec);if (existingActors != null){//get list of user namesSet<Users> users = existingActors.getUsers();users.each { user->sb.append(user.getName() + ', ')}}sb.append("\n")}return sb.toString()
It looks like you're new here. Sign in or register to get started.