How to Make Confluence Space Permissions page read-only?

Andreas von Euw
Contributor
August 17, 2018

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

3 answers

1 accepted

1 vote
Answer accepted
Moses Thomas
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 20, 2018

@Andreas von EuwI 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!

Andreas von Euw
Contributor
August 29, 2018

@Moses Thomas: 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?

Moses Thomas
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 29, 2018

@Andreas von EuwOnly on the permission  page,   other  buttons will  not be affected.

Andreas von Euw
Contributor
August 29, 2018

Thanks Moses !

Moses Thomas
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 29, 2018

You are welcome!

Andreas von Euw
Contributor
August 29, 2018

@Moses Thomas: 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 :-) ?

Moses Thomas
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 30, 2018

@Andreas von EuwOfcourse  we could do it by  modifying script, but please could you show me via  screen shot which button is missing ?

Andreas von Euw
Contributor
August 30, 2018

attach.gif
This yellow one on each attachments page.

Andreas von Euw
Contributor
August 30, 2018

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>
Moses Thomas
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 30, 2018

@Andreas von EuwNice 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.

Andreas von Euw
Contributor
August 31, 2018

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

Moses Thomas
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 31, 2018

@Andreas von EuwGreat!  this  is another  solution,  so  lets replace hide() with  remove();  so that  some one will  not make some nasty  move in the developer view.

Andreas von Euw
Contributor
August 31, 2018

cool, thank you!

Tobias Anstett _K15t_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 4, 2018

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

Moses Thomas
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 5, 2018
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!
0 votes
Abhijit Das November 26, 2018

@Andreas von Euw - 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> ... Mind posting an example?

Andreas von Euw
Contributor
November 29, 2018

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.

Abhijit Das November 29, 2018

Is it possible to share the add-on, or is it proprietary?

0 votes
Moses Thomas
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 17, 2018
Andreas von Euw
Contributor
August 17, 2018

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

Moses Thomas
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 17, 2018

@Andreas von EuwEvery  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!

Andreas von Euw
Contributor
August 17, 2018

@Moses ThomasDon'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 ...

Moses Thomas
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 17, 2018

@Andreas von EuwAhh  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.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events