Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to show or hide space categories based on user access to space

Seweryn Szatkowski
Contributor
April 22, 2020

Hi,

I'm looking for a way to hide/show categories based on user access to spaces.

I have found a way to hide categories for users who are not in certain group:

#if ($userAccessor.hasMembership('confluence-administrators',    $helper.action.remoteUser.name))
#else
<script type="text/javascript">
AJS.toInit(function(){
    AJS.$('#space-labels-list').hide();
    AJS.$('.aui-nav-heading').hide();
});
</script>
#end

Above solution was posted here: https://community.atlassian.com/t5/Confluence-questions/Hide-categories-in-Confluence-page/qaq-p/1169745

But do you know how to hide/show categories based on user access to certain space?

Example:

Space name: A,
Category: nameA
Access: only to userA

Space name: B,
Category: nameB
Access: only to userB

And now if I'am userA I want to see only category nameA because I have an access to space A and if I'am userB I want to see only category nameB because I have an access to space B.

Is there a way to do that using Layouts and by modifying above script?

Regards

-- 

Seweryn

1 answer

0 votes
Diego
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 27, 2020

Hello @Seweryn Szatkowski !

As I understand, you need to hide or show labels within spaces based on user permissions inside Confluence.

If the above is correct, I am unaware on how to proceed with this.

However, if we are talking about actually hiding pages from users who are part of an specific group, we can use page restrictions for this purpose:

 

You would need to include who can see the content in the restrictions. For example:

  1. Create page-00
  2. Put it under categoryA
  3. Restrict access solely to categoryA members in restrictions
  4. Create page-01
  5. Put it under categoryB
  6. Restrict access solely to categoryB members in restrictions

 

Now only members of categoryA can see the page under categoryA, no one else. The same goes for categoryB.

 

Let us hear from you!

Seweryn Szatkowski
Contributor
April 29, 2020

Hello @Diego 

Thank you very much for your answer. Unfortunately it will not help me because my case is to hide space categories from users who do not have access to spaces under this categories.

I know how to restrict access for pages or spaces but right now even if I restrict access to space for particular group of users, others will be able to see this page category. It is problematic when I use client names as categories and I don't want clients to see each other.

This case is well described in this question: 
https://community.atlassian.com/t5/Confluence-questions/Hide-Confluence-Categories/qaq-p/656762

Also there is an open issue for that feature here: 
https://jira.atlassian.com/browse/CONFSERVER-43563

Regards

-- 

Seweryn

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events