I want to set permission rule while creating structure using scriptrunner

Jaspreet Kaur September 8, 2020

Hello Team,

image.pngI want to these two permission rules while creating structure using scriptrunner.

2 answers

0 votes
Philip Heijkoop _ALM Works_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
September 9, 2020

Hi Jaspreet,

I've added a snippet below (omitted the imports for brevity) that shows you the code to add permissions. You will need to look up the PPT Admins group id on your Jira instance to reference.

def structure = structureManager.createStructure().setName("example struture").saveChanges() // you can also get a pre-existing structure
def permissions = []
permissions.addAll(structure.getPermissions()) // this makes sure you don't delete any previous permissions
permissions.add(PermissionRule.fromEncodedString("set:EDIT:role:10572:10022"))
structure.setPermissions(permissions)
structure.saveChanges()

 

If you'd like to add those permissions, the easiest way would be to reference those structures and print their getPermissions() method results in the script console, you could also use that method described above to copy the permissions from one structure to another.

Hope this helps. If you have any further questions about Structure and scripting, feel free to reach out to our solutions team at solutions@almworks.com or our fantastic support crew at support.almworks.com

Jaspreet Kaur September 21, 2020

@Philip Heijkoop _ALM Works_ 

Thanks for your help. it worked

0 votes
Alessandro C_ _ALM Works_ September 9, 2020

Hi Jaspreet, Alessandro from ALM Works here.

Could you please create a ticket at support.almworks for this?

Using Scriptrunner goes beyond using Structure default features so we would like to better understand what you are trying to accomplish with a customized solution.

Best regards,
Alessandro C.
ALM Works

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events