Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,459,203
Community Members
 
Community Events
176
Community Groups

Modify Global Permission Groups in bulk

Edited

Hi All,

Has anyone removed Groups from a Global Permission in bulk?

We have:

  • A custom (app-based) global permission, giving access to an app
  • ~30-50K groups in the global permission
  • Jira Data Center

We'd like to:

  • Remove all groups, aside from jira-software-users, and a few other platform-wide groups

^ Has anyone done this before without doing it manually? We have ScriptRunner, if that helps!

Ste

1 answer

1 accepted

1 vote
Answer accepted

Assuming this app global permission are stored like all the other global permissions, you should be able to use https://docs.atlassian.com/software/jira/docs/api/8.13.6/com/atlassian/jira/security/GlobalPermissionManager.html

With Scriptrunner console, print the list of permission keys:

import com.atlassian.jira.security.GlobalPermissionManager
import com.atlassian.jira.component.ComponentAccessor

return ComponentAccessor.getComponent(GlobalPermissionManager).allGlobalPermissions*.key

If you can identify the key for you app that you want to modify, plug it in here:

import com.atlassian.jira.security.GlobalPermissionManager
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.permission.GlobalPermissionKey

def PERMISSIONKEY_TO_CLEANUP = 'XXX'
def GROUPS_TO_KEEP = ['jira-software-users', 'other-group-name']

def gpm = ComponentAccessor.getComponent(GlobalPermissionManager)
gpm.allGlobalPermissions.each{ perm->
if(perm.key == PERMISSIONKEY_TO_CLEANUP){
gpm.getGroupsWithPermission(GlobalPermissionKey.of(perm.key)).each{group->
if(!GROUPS_TO_KEEP.contains(group.name)){
gpm.removePermission(perm, group.name)
}
      }
   }
}

I haven't actually tested this or used this manager before, I just found it by searching the Javadoc... so be careful with it.

Hi @Peter-Dave Sheehan 

Finally got a chance to test this, it works awesome!

Thanks so much for this!

Ste

Thanks @Peter-Dave Sheehan , It worked for me as well.

Suggest an answer

Log in or Sign up to answer