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 Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Monday in Jira Software

How large do you think Jira Software can grow?

Hi Atlassian Community! My name is Shana, and I’m on the Jira Software team. One of the many reasons this Community exists is to connect you to others on similar product journeys or with comparabl...

587 views 6 12
Read article

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