Bulk edit Confluence space permissions
Asked by ehteshamuddin:

Hello All,  

We have number of spaces created and when we check space admins we get conflunece admin names with space admin.As confluence admins are one who created it.

In global permisions we have found confluence admins has space admin rights due to which we can see them. But now we planned to remove space admin rights after creating and assigning a space admin.  

But question is how to change or remove or edit bulk space permissions?


Answers:
author: Alexey Matveev
body: Hello,

You could also use the Power Scripts for Confluence add-on:

[https://marketplace.atlassian.com/apps/1219507/power-scripts-for-confluence?hosting=server\&tab=overview](https://marketplace.atlassian.com/apps/1219507/power-scripts-for-confluence?hosting=server&tab=overview)

It is a free add-on. I've found Power Scripts for Confluence really handy for Confluence admins who want to automate their work and apply bulk actions to Confluence.

You could use the [addGroupToSpacePermission](https://confluence.cprime.io/display/PSCONF/addGroupToSpacePermission) method to change permissions of a space.

comments: author: DORIAN KERSCH
body: Hi Alexey,

Do you have a snippet for this already or a repository where we keep "common power scripts"?

My use case is similar:

For all spaces ([getAllSpaces](https://confluence.cprime.io/display/PSCONF/getAllSpaces?src=contextnavpagetreemode)), check if group has "confluence-users" as a group (using [groupExists](https://confluence.cprime.io/display/PSCONF/groupExists?src=contextnavpagetreemode) or [groupHasSpacePermission](https://confluence.cprime.io/display/PSCONF/groupHasSpacePermission?src=contextnavpagetreemode)) and if it does then apply "new-group" to that space ([addGroupToSpacePermission](https://confluence.cprime.io/display/PSCONF/addGroupToSpacePermission?src=contextnavpagetreemode)).

I foresee similar situation for removing groups ([removeGroupFromSpacePermission](https://confluence.cprime.io/display/PSCONF/removeGroupFromSpacePermission?src=contextnavpagetreemode)).


author: DORIAN KERSCH
body: Spoke with the power-scripts folks. Below is a snippet that we created in order to solve that need.

Note: If you want to see the logs make sure you follow these [steps](https://confluence.cprime.io/display/PSCONF/logPrint) (you may need to add the logger to your logging and profile section)

```
string loglevel = "INFO";
logPrint(loglevel, "Starting Modification of group space permissions");
date startTime = currentDate();
logPrint(loglevel, startTime);

string [] spaces = getAllSpaces();

string [] newPermissions;
string newGroup = "change-me";
string oldGroup = "change-me";

// Check if the group exists
if (groupExists(newGroup)) {
 // iterate through all spaces
 for(string space in spaces) {
 
 logPrint(loglevel, "Checking this space " + space);
 
 // Does it have the group we want to mimic? 
 string [] permissions = groupSpacePermissions(space, oldGroup);
 
 logPrint(loglevel, "Permissions for space " + permissions);
 
 if(size(permissions) > 0) {
 // add all the same permissions for the new group
 for(string perm in permissions) {
 // I think there is a bug about EXPORTPAGE so exclude it for now 
 if (isNotNull(perm) and perm != "EXPORTPAGE") {
 // add the new group
 addGroupToSpacePermission(perm, space, newGroup);
 // we may want to remove the old group permissions
 // untested but a fast way to do it would be to remove the VIEWSPACE
 // if that is the case you can remove it out of this for loop all together
 // removeGroupFromSpacePermission(perm, space, oldGroup);
 }
 }
 // get the permissions
 newPermissions = groupSpacePermissions(space, newGroup);
 
 logPrint(loglevel, "Successfully added " + newGroup + " to space " + space + " with these permissions " + newPermissions);
 } else {
 logPrint(loglevel, "Not adding " + newGroup + " to this space " + space);
 }
 logPrint(loglevel, "end of space modification for " + space + " -------------------------");
 // I used this break to just test the modification of one space before site-wide
 // break;
 }
}

logPrint(loglevel, "Finished running SIL for space group permission modification");
date endTime = currentDate();
logPrint(loglevel, endTime);
```


author: Stella Schneider -Smateso-
body: Hi there!

If anyone is still searching for a solution on how to manage multiple space and page permissions without scripting in Confluence here it is!

We just released our new app "[Permission Management for Confluence](https://marketplace.atlassian.com/1229872)".

So feel free to give it a try and let us now, if you like it or what you need.

Best regards

Stella

comments: author: Joel Andrews
body: Hi [@Stella Schneider](/t5/user/viewprofilepage/user-id/4149020) , do you have a Cloud equivalent?


author: Stella Schneider
body: Hi [@Joel Andrews](/t5/user/viewprofilepage/user-id/2401777)

thanks a lot for your interest in our app!

We are currently developing the cloud version and are hoping to release it soon!

I will let you know as soon as it is online.

Best regards

Stella


author: Joel Andrews
body: Thank you!


author: Stella Schneider
body: Hi [@Joel Andrews](/t5/user/viewprofilepage/user-id/4742271) ,

we released our cloud version beginning of this year.

Due to limitations in the Atlassian Forge Toolkit and the Cloud API, the cloud version of "Permission Management for Confluence" has reduced functionality, compared to the Data Center Version.

However, we are developing and improving the app further. So please give it a try and let us know what you think and which features you need. :)

Best regards

Stella


author: Natalia Lezhai
body: Hi [@Alexey Matveev](/t5/user/viewprofilepage/user-id/1159601) and [@DORIAN KERSCH](/t5/user/viewprofilepage/user-id/1895659)

is there a version for Confluence cloud available ? we use power scripts add-on for jira. but need for confluence as well, as problems with spaces having wrong user groups added is very important and the ability to edit them in bulk would be awesome.

thanks


author: Marcelo Horlle
body: Hey Ehteshamuddin,

There is no way of doing that through the UI, but we have some options to run this exercise through Command Line. They have been already been shared by a colleague on another question. You might want to take a look on it, I think it will help you out! Check it out [here](https://community.atlassian.com/t5/Confluence-questions/Bulk-edit-Confluence-space-permissions/qaq-p/236660).

Hope it helps, have a great week ahead!


Tags: permission

space