Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,559,511
Community Members
 
Community Events
184
Community Groups

How to change in list ?

Hello,

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.ComponentAccessor
import 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.Users
def 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 projects
projectManager.getProjectObjects().each{

//get all project admins for that project
ProjectRoleActors existingActors = projectRoleService.getProjectRoleActors(administrator,it,ec);
if (existingActors != null){
//get list of user names
Set<Users> users = existingActors.getUsers();
users.each { user->
sb.append(user.getName() + ', ')
}
}
sb.append("\n")
}
return sb.toString()

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events