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,460,910
Community Members
 
Community Events
176
Community Groups

Give a Jira group application access

Hi all,

I am writing a script to create and manage groups in Jira Server. I can create a group:

ComponentAccessor.groupManager.createGroup(groupName)

However, I need to be able to give a group application access after I create it. How can I do this?

Thanks!

2 answers

1 accepted

0 votes
Answer accepted

I've never tried ... but looking through the javadocs, I found "ApplicationRoleAdminService"

So playing around with it... I was able to get it to work with these few lines of code:

import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.scriptrunner.runner.customisers.PluginModule
import com.atlassian.jira.application.ApplicationRoleAdminService
import com.atlassian.jira.application.ApplicationKeys

@PluginModule ApplicationRoleAdminService applicationRoleAdminService

def groupToAdd = ComponentAccessor.groupManager.getGroup('NameOFGroupToAdd')

def role = applicationRoleAdminService.getRole(ApplicationKeys.SOFTWARE ).get()
def defaultGroups = role.defaultGroups
def currentGroups = role.groups
def newGroupList = currentGroups + groupToAdd
def newRole = role.withGroups(newGroupList, defaultGroups)

applicationRoleAdminService.setRole(newRole)

Change the ApplicationKeys.SOFTWARE to any one of those listed here

Hi Peter-Dave,

That works perfectly. Thanks for taking the time to reply. Have a great day.

What exactly do you mean by "application access"?

Should the group have the license assigned like "jira-users" or would you like to add the group to a project role?

Hi there,

Yes, should have the licence assigned like jira-users. Manually I would go to admin -> applications - > application access then select the group using the drop-down and add it to the application.

Thanks!

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events