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?
Try this,
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.