You can easily remove all permissions from a Confluence DC Space, or a Confluence Cloud Space. Confluence Server, though? You’re out of luck.
Imagine you migrated from Confluence Cloud to Confluence Server, and you wanted to remove all permissions on a Space (except for maybe “View Space”). That’s a whole lot of manually clicking, unless you script it. You’re going to need ScriptRunner for this.
The script below takes two inputs: a Space key, and a username. It needs the username of someone on the Space with Admin access, because Confluence will not let you remove EVERYONE with admin access from the Space.
Someone gets left behind.
Okay so it takes those two pieces of information as variables. It then makes use of two arrays. The first array is a prescribed selection of the permissions you’d like removed from the Space. Want to let everyone keep the View Space permission type? Take it out of the List!
The second array is generated by the script. It’s a list of every username and group name with some kind of permission on the Space.
We then nest two loops, and iterate through the permission types and usernames. For each permission type,