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)
}
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.