Make restrictions visible on page

Matthias Droste October 23, 2013

We have restrictions based on groups in our confluence-setup.

In order to avoid accidentally adding content that should only be visible for Group A to a page that's also visible for Group B, I'd like to have the groups that have access to the page visible directly on the page.

Is there a way to do this?

Currently we use the workaround to add tags like <Group A> <Group B> to the page. However, the more content is added, the more difficult it becomes to keep the tags in sync with the actual restrictions...

1 answer

1 vote
Davin Studer
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.
October 23, 2013

Here is a user macro that you can use to show the page permissions.

## Macro title: restrictions
## Macro has a body: N
## Developed by: Davin Studer
## Date created: 10/24/2013
## @noparams

###################
##    Viewers    ##
###################
#set ($vPerms = $content.getContentPermissionSet("View"))
#if ($vPerms &amp;&amp; $vPerms.size() &gt; 0)
    Viewing Groups:&lt;br /&gt;
    &lt;ul&gt;
    #foreach($vPerm in $vPerms)
        #if($vPerm.isGroupPermission())
           &lt;li&gt;$vPerm.getGroupName()&lt;/li&gt;
        #end
    #end
    &lt;/ul&gt;
    Viewing People:&lt;br /&gt;
    &lt;ul&gt;
    #foreach($vPerm in $vPerms)
        #if($vPerm.isUserPermission())
           &lt;li&gt; $vPerm.getUserSubject().getFullName()&lt;/li&gt;
        #end
    #end
    &lt;/ul&gt;
#end

###################
##    Editors    ##
###################
#set ($ePerms = $content.getContentPermissionSet("Edit"))
#if ($ePerms &amp;&amp; $ePerms.size() &gt; 0)
    Editing Groups:&lt;br /&gt;
    &lt;ul&gt;
    #foreach($ePerm in $ePerms)
        #if($ePerm.isGroupPermission())
            &lt;li&gt;$ePerm.getGroupName()&lt;/li&gt;
        #end
    #end
    &lt;/ul&gt;
    Editing People:&lt;br /&gt;
    &lt;ul&gt;
    #foreach($ePerm in $ePerms)
        #if($ePerm.isUserPermission())
            &lt;li&gt;$ePerm.getUserSubject().getFullName()&lt;/li&gt;
        #end
    #end
    &lt;/ul&gt;
#end

Davin Studer
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.
October 23, 2013

I realize that the output of this user macro is certainly not pretty(I'm no designer). You might want to edit it to look a little nicer, but the functionality is there.

Davin Studer
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.
October 28, 2013

Hmmm. Just realized that you tagged the question as confluence-ondemand. In that case there is no way.

Matthias Droste October 28, 2013

Right, I tried to try your suggestion out, only to find that I'm pretty limited by using on-demand :-(

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events