Remove a permission for a group from all projects?

I would like to remove the browse permission for the group jira-users for all projects. As there are many projects (as well as many schemes) I would like to use a script.

Within the JIRA-Administration, I can remove the group by removing the group directly from the browse permission (in the scheme) and by removing the group from the project roles which have the browse permission (in the scheme).

I have the permission and the group, for which I want delete the permission. I have all the projects and permission schemes. And I have the permission manager, with which I should be able to delete the permission.

def jiraUserGroup = ComponentAccessor.getGroupManager().getGroup("jira-users")

def browsePermissionId = Permission.BROWSE.getId();

def permissionManager = ComponentAccessor.getPermissionManager()

def permissionSchemes = ComponentAccessor.getPermissionSchemeManager().getSchemeObjects()

def projects = ComponentAccessor.getProjectManager().getProjectObjects()

But I didn't find any helpful methods, which do what I want. Could anybody give me a hint?

1 answer

1 accepted

1 vote

Have you try permissionManager.removeGroupPermissions("jira-users") ?

The call removeGroupPermission("jira-users") would remove all priviledges from jira-users.

I only want to remove the browse-permissions for all projects. The jira-users should still be able to log-in. I just want to make sure, that projects are only seen by the right group. Therefore all users are grouped into serveral groups and these groups will get the particular browse priviledges.

What is your JIRA version?

Right now, we are using JIRA 5.0.7.

Doing it from the JIRA API is quite complicated. How about doing it from the database?

DELETE FROM schemepermissions WHERE PERMISSION = 10 AND perm_type = 'group' AND perm-parameter = 'jira-users';
DELETE FROM projectroleactor WHERE ROLETYPE = 'atlassian-group-role-actor' AND ROLETYPEPARAMETER = 'jira-users';

You may need to restart JIRA for it to take effect. Remember to backup JIRA for rollback purposes.

It's not the most elegant way to use SQL instead of an API, but I guess it is the simplest.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Apr 17, 2018 in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

765 views 2 19
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you