Bulk edit Confluence space permissions

ehteshamuddin April 11, 2017

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? 

4 answers

1 vote
Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 17, 2018

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

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 method to change permissions of a space.

DORIAN KERSCH November 7, 2018

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), check if group has "confluence-users" as a group (using groupExists or groupHasSpacePermission) and if it does then apply "new-group" to that space (addGroupToSpacePermission).

 

I foresee similar situation for removing groups (removeGroupFromSpacePermission). 

DORIAN KERSCH November 7, 2018

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 (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);
Like # people like this
0 votes
Stella Schneider -Smateso- January 16, 2023

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”.

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

Best regards

Stella

Joel Andrews October 13, 2023

Hi @Stella Schneider , do you have a Cloud equivalent? 

Stella Schneider October 13, 2023

Hi @Joel Andrews

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

Joel Andrews October 13, 2023

Thank you!

0 votes
Natalia Lezhai May 16, 2019

Hi @Alexey Matveev and @DORIAN KERSCH 

 

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 

0 votes
Marcelo Horlle
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 12, 2017

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.

Hope it helps, have a great week ahead!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events