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.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.