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

Add group permission to every Space

Hi!

 

I want to add a global read only group to every existing space.

I already set it in the default for new spaces, but how can I update all existing spaces?

1 answer

1 vote
DPK_J Community Leader Aug 16, 2019

Try this,

  • Login in to confluence using admin permission
  • move to and admin page
  • Open JS console in browser (CMD + SHIFT + I on MacOS)
  • Paste following JS code and press Enter.
jQuery.ajax({dataType: 'json',
            contentType: 'application/json',
            type: 'POST',
            url: contextPath + '/rpc/json-rpc/confluenceservice-v2/getSpaces',
            success: function( data ) {
              jQuery(data).each(function() {
                if (this.type === "global") {
                  var requestArray = [];
                  var permissionsArray = [];
                  permissionsArray.push("VIEWSPACE");
                 
                  requestArray.push(permissionsArray);
                  requestArray.push("<your_new_group>");
                  requestArray.push(this.key);
                  jQuery.ajax({dataType: 'json',
                              contentType: 'application/json',
                              type: 'POST',
                              url: contextPath + '/rpc/json-rpc/confluenceservice-v2/addPermissionsToSpace',
                              data: JSON.stringify(requestArray),
                              success: function( data ) {
                                console.log(data);
                              }
                  });
                }
              });
            }
});

 

You have to replace <your_new_group> with name of group.

You can add more permission to above 'permissionsArray' like this

permissionsArray.push("EDITSPACE");
permissionsArray.push("EXPORTPAGE");
permissionsArray.push("SETPAGEPERMISSIONS");
permissionsArray.push("REMOVEPAGE");
permissionsArray.push("EDITBLOG");
permissionsArray.push("REMOVEBLOG");
permissionsArray.push("COMMENT");
permissionsArray.push("REMOVECOMMENT");
permissionsArray.push("CREATEATTACHMENT");
permissionsArray.push("REMOVEATTACHMENT");
permissionsArray.push("REMOVEMAIL");
permissionsArray.push("EXPORTSPACE");
permissionsArray.push("SETSPACEPERMISSIONS");

 

You can try this on staging before running on production.

Hi!

 

Thank you  -it worked!

But @atlassian - are you serious????

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Confluence

How is your team having fun and bonding, remotely, utilizing Confluence?

Thanks everyone for answering last week’s question. The winner of the random drawing from those who commented is: @LarryBrock I’ll contact you separately with your prize details. This wee...

278 views 9 6
Join discussion

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you