How to Make Confluence Space Permissions page read-only?
Asked by Andreas von Euw:

In our Environment we mange the Space permissions not from within Confluence.

Permissions are managed in a central component and are updated in Confluence using a REST API.

We don't want that Space Admins can change permissions in Confluence directly.

Question: Is there a possibility to make the Space Permission Page read-only?  
(/confluence/spaces/spacepermissions.action?key=\<spacekey\>)

Regards, Andy


Answers:
author: Moses Thomas
body: [@Andreas von Euw](/t5/user/viewprofilepage/user-id/510295)I suppose you are managing permission via rest API, here is a script that will globally hide permission tables and possibility to "Edit"

Please note that this Just hide the tables and buttons, but does no harm to permissions it self.

Add to Custom HTML " At end of the HEAD" once log in as confluence administrator

```

<script>
 AJS.toInit(function(){
 AJS.$('#gPermissionsTable').hide();
 AJS.$('#uPermissionsTable').hide();
 AJS.$('#aPermissionsTable').hide();
 AJS.$(".buttons-container").hide(); 
 });
</script>
```

Best!

comments: author: Andreas von Euw
body: [@Moses Thomas](/t5/user/viewprofilepage/user-id/1138700): Thanks a lot. This does really look okay for now. We only hide the buttons-container, because we would like to see the current permissions.

But a last question, is this .buttons-container only used on the permission page? Or do we hide buttons on other pages as well now?


author: Moses Thomas
body: [@Andreas von Euw](/t5/user/viewprofilepage/user-id/510295)Only on the permission page, other buttons will not be affected.


author: Andreas von Euw
body: Thanks Moses !


author: Moses Thomas
body: You are welcome!


author: Andreas von Euw
body: [@Moses Thomas](/t5/user/viewprofilepage/user-id/1138700): Found another button that got hidden because of the custom html:  
The attach button on the attachment page has gone.

So, we should limit this to the permission page only . how can we achieve this, any idea :-) ?


author: Moses Thomas
body: [@Andreas von Euw](/t5/user/viewprofilepage/user-id/510295)Ofcourse we could do it by modifying script, but please could you show me via screen shot which button is missing ?


author: Andreas von Euw
body: ![attach.gif](https://community.atlassian.com/t5/image/serverpage/image-id/30851i426CD3A172976AFC/image-size/large?v=v2&px=999 "attach.gif")  
This yellow one on each attachments page.


author: Andreas von Euw
body: this is the html with the div buttons-container:  

```
<div class="buttons-container">
??? <div class="buttons">
??? <input name="confirm" class="submit aui-button " id="edit" type="submit" value="Attach">
??? </div>
</div>
```


author: Moses Thomas
body: [@Andreas von Euw](/t5/user/viewprofilepage/user-id/510295)Nice one :D for spotting it, and interesting now we will have to deal with this case, the value "attach " is the first element in the container i did some test with slice() and remove()/hide()**(almost same method)**, i notice that when i leave the slice of the first element they both appear in both screen. so we need to have an if condition when we are in the attachment screen we do nothing :). i will give you feed back soon.


author: Andreas von Euw
body: Hi Moses,  
I've found the correct jquery to disable my edit permission button on the space permission page only:

```
<!-- to disable edit permission button on space permission page -->
<script>
?  AJS.toInit(function(){
?  AJS.$('form[name="editspacepermissions"]').hide();
?});
</script>
```

Thanks for showing me the right way to solve this.

Regards, Andy


author: Moses Thomas
body: [@Andreas von Euw](/t5/user/viewprofilepage/user-id/510295)Great! this is another solution, so lets replace hide() with remove(); so that some one will not make some nasty move in the developer view.


author: Andreas von Euw
body: cool, thank you!


author: Tobias Anstett _K15t_
body: Hi,

Just a quick note about the script
>
> ```
> <script>
>  AJS.toInit(function(){
>  AJS.$('#gPermissionsTable').hide();
>  AJS.$('#uPermissionsTable').hide();
>  AJS.$('#aPermissionsTable').hide();
>  AJS.$(".buttons-container").hide(); 
>  });
> </script>
> ```

If you use hide() the elements still reside in the dom tree. You should remove or detach them to really get rid of them.

Furthermore you should consider to add a custom plugin defining a servlet filter which redirects from the actions or blocks at least the save operation.

Best,  
Tobias


author: Moses Thomas
body: > ```
> I have already? mentioned? to? replace hide() with? remove()? and this?? solution is? buggy,? because? the? class? is? used in? the add attachment screen.
>
> ?class="buttons-container"
>
> ?This? is? the? easy solution for? this request
>
> <script>
> ?? AJS.toInit(function(){
> ?? AJS.$('form[name="editspacepermissions"]').remove();
> ?});
> </script>
>
> best!
> ```


author: Abhijit Das
body: [@Andreas von Euw](/t5/user/viewprofilepage/user-id/510295) - How do you edit the permission of the space using the API. trying to form a curl syntax for the page, [https://confluence.sd.apple.com/spaces/editspacepermissions.action?key=\<key](https://confluence.sd.apple.com/spaces/editspacepermissions.action?key=<key)\> ... Mind posting an example?

comments: author: Andreas von Euw
body: As Confluence do not provide a REST API to do this we've created our own Confluence Add-On to provide additional REST methods to edit space permissions remotely.


author: Abhijit Das
body: Is it possible to share the add-on, or is it proprietary?


author: Moses Thomas
body: [@Andreas von Euw](/t5/user/viewprofilepage/user-id/510295)Please see articles below

* firstly global permission overview <https://confluence.atlassian.com/doc/global-permissions-overview-138709.html>
* secondly space permission overview [https://confluence.atlassian.com/doc/space-permissions-overview-139521.html](https://confluence.atlassian.com/doc/space-permissions-overview-139521.html??)
* thirdly assign space permission <https://confluence.atlassian.com/doc/assign-space-permissions-139460.html>

Best!

comments: author: Andreas von Euw
body: Hi Moses,  

Thanks for the quick answer. But this doesn't solve my Problem.

It's not done by removing the Space "admin" permission from all users. We need still users with Space admin permission.  

From the Space Permission docu the admin permission is relevant:  
**"Admin** gives you permission to access all space administration tools, including things like permissions, templates, look and feel, and the ability to delete the whole space. "

We just want to remove the ability to edit permissions. But all the other tools like templates, export, look and feel should still be available to the Space Admins.

Regards, Andy


author: Moses Thomas
body: [@Andreas von Euw](/t5/user/viewprofilepage/user-id/510295)Every thing you need is there, but let me explain, if you want to remove Edit for the whole space, go to space tool \> permission \> edit permission and make the the "add" red that is you unchecked this permission for any group/user

Best!


author: Andreas von Euw
body: [@Moses Thomas](/t5/user/viewprofilepage/user-id/1138700)Don't understand your answer. I know the Space Tools quite well. What do you mean with "make the the 'add' red" ? What permission are you exactly talking about?

But anyway. There is nothing to uncheck on this Screen that would solve my Problem ...


author: Moses Thomas
body: [@Andreas von Euw](/t5/user/viewprofilepage/user-id/510295)Ahh Andrew i guess i miss understood your question you don't want space admin to change permission i suppose you want to hide this possibility then you will need a script or a work around is Just to set only one space admin, infact there has to be a space admin.


Tags: confluence-server

permission

server