I'm an admin and control access to a few spaces. We restrict areas within spaces to a smaller group of users. I use groups to control access at the space and page level.
What I would like to accomplish is to display on the restricted page exactly who has access (including a breakout of all group members, not just the group name) to create transparency and build confidence in the selected user group that they are posting in the appropriately restricted area.
Looking at restrictions takes time, and I don't know if there is any easy way for non-admin users to see who is in a group.
Trying to create some transparency. A widget like the "children pages display" would be ideal, as this doesn't require code and is super easy to use.
Thanks for advice.
Hello:
Here's a basic Confluence user macro I put together. It lists out the users with individual permissions, and then the groups with permission and the users in the groups:
## @noparams
#set($permissions = $content.permissions)
#set($userNamesArray = [])
#set($groupNamesArray = [])
#foreach ($permission in $permissions)
#if($permission.userSubject && $permission.userSubject.name && !$userNamesArray.contains($permission.userSubject.name))
#set($unused = $userNamesArray.add($permission.userSubject.name))
#end
#if(!$permission.userSubject.name)
#if(!$groupNamesArray.contains($permission.groupName))
#set($unused = $groupNamesArray.add($permission.groupName))
#end
#end
#end
<h3>Users With Page Access</h3><br>
#foreach ($userName in $userNamesArray)
$userName<br>
#end
#foreach ($groupName in $groupNamesArray)
##Start group-loop
<h3>Groups With Page Access:<br>
<b> $groupName</b></h3><br>
#set($group = $userAccessor.getGroup($groupName))
#set($members = $userAccessor.getMemberNames($group))
Group Members:<br>
#foreach($member in $members)
$member <br>
#end
##End group-loop
#end
The output on the page looks like this:
admin
jsmith
Group Members:
admin
jsmith
Hi Ken,
Appreciate your answer. I’m a dummy and don’t mess around with macros, but I guess I could try it.
I was really hoping there was a widget (like the child pages widget) available that I just hadn’t found that would make this super easy.
Maybe atlassian will turn your macro into a widget for us dummies one day!
Thanks for your help.
Jake
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.