It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Bulk edit Confluence space permissions

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? 

2 answers

1 vote

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.

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

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 1 person likes this
0 votes

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
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published Thursday in Confluence

Confluence CVEs and common questions

Two vulnerabilities have been published for Confluence Server and Data Center recently: March 20, 2019 CVE-2019-3395 / CVE-2019-3396 April 17, 2019 CVE-2019-3398 The goal of this article is...

268 views 0 12
Read article

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