How to add and remove groups in bulk on Global Permissions page
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
Sometimes there is ad hoc requirements to add or remove a lot of groups from Global Permissions page in Confluence, if you are migrating from one user directory to another.
Solution
The recommended approach to add or remove users/groups under Global Permissions is to make changes from the admin UI instead of directly modifying the database. When you uncheck all the global permission types and click Save all, the users and groups are removed from Global Permissions and the changes get reflected immediately.
Warning
Always backup your data before performing any modifications to the database. If possible, test any alter, insert, update, or delete SQL commands on a staging server first.
Deleting entries in bulk
Execute below DELETE statement to remove the Confluence groups in bulk :
delete from spacepermissions where permgroupname IN ('<USER_GROUP1>', '<USER_GROUP2>',........);
Once the entries are removed from the database SPACEPERMISSIONS table, the changes won't be reflected on > General Configuration > Global Permissions page unless you perform one of the following two actions :
- Go to > General Configuration > Cache Management > Flush all
- Or Restart Confluence instance.
Adding entries in bulk
Use below INSERT statement to add the groups on the Global Permissions page, replacing the values between tags <> accordingly:
insert into SPACEPERMISSIONS (SPACEID, PERMTYPE, PERMGROUPNAME, PERMUSERNAME, PERMALLUSERSSUBJECT, CREATOR, CREATIONDATE, LASTMODIFIER, LASTMODDATE, PERMID) values (null, '<PERMTYPE>', '<USER_GROUP>', null, null, '<USER_KEY>', now(), '<USER_KEY>', now(), '<PERMID>')
You can create a PL/SQL script and loop the above INSERT statement to add groups in bulk.