You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
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!
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.