How to retrieve groups which have roles in a project

How can I retrieve the groups which are allocated roles in a project.

i.e. Administrators = jira-administrators 

1 answer

0 vote
Micky Caritte Community Champion Jan 18, 2018

Hi Daniel,

If I understand correctly you want an overview of groups usage in Roles overall?

That's not possible OOTB I'd say but with a few database query you might get that if you're familiar with SQL.

There might also be plugins able to help you, I've created one for group management which has a feature of showing group usage in projects but only for groups you belong to, it's called Group Ambassadors, there might be others (just checked but don't have enough time to deeply analyze).

If you need a free, quick solution you might go with SQL. I know Insight Asset Management plugin have an extension to graphically represent your instance configuration, that might be available there as well.

A lot of ideas, please let us know if any worked for you!

Cheers

Thanks Micky, yes you're correct, I should have mentioned I was scripting in Groovy to try and retrieve this. 

It appears that my script currently does get "groups" but doesn't label that to be the case, it will show the content of users in each group, which do have a role, but not the group name. 

Thanks for the tip!

Micky Caritte Community Champion Jan 18, 2018

In my plugin the java classes I,m using are mostly ProjectRoleManager and ProjectManager:

ProjectRoleManager prm = ComponentAccessor.getComponent(ProjectRoleManager.class);
ProjectManager pm = ComponentAccessor.getProjectManager();
for(Long pid : prm.getProjectIdsContainingRoleActorByNameAndType(group,ProjectRoleActor.GROUP_ROLE_ACTOR_TYPE)) {
...
}

The pid long var will give all project ids where the "group" parameter (A String containing a group name) have a role. 

You can then use ProjectRole class to identify the project role (in my case and it's not ideal I use:

List<ProjectRole> rids = new ArrayList(prm.getProjectRoles());
for(ProjectRole pr : rids) {
if(!prm.roleActorOfTypeExistsForProjects(pid,pr,ProjectRoleActor.GROUP_ROLE_ACTOR_TYPE,group).isEmpty()) {

}
}

 Hope this will help :)

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,314 views 14 20
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot