Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Check If Permission Entity Exists Via API

Paul Tiseo
Contributor
October 22, 2018

I have a ScriptRunner script that adds multiple permissions to scheme for a given user, group or role. But, if I run it twice, it adds duplicates. Is there a class/method that checks if a permission entity already exists? Also, how do I delete an entry via the API?

Here's the block that adds:

 if(permsToAdd.any({ it == prjPerm.getKey() })) {
// add it, if not present (or we get dups)
SchemeEntity schemeEntity = new SchemeEntity(permType, permRoleId, prjPerm.getKey())
permSchemeMgr.createSchemeEntity(scheme, schemeEntity)
}

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events