Is there a macro to display all users, who are allowed to watch a page?
We have users who want to know beforehand, who will be able to read something they post.
Great question. I would like to have this functionality. Even better would be: check if user XXX is able to view THIS page.
Here is a user macro I created that shows the restriction set on a page. This will only show the page restrictions ... meaning it doesn't take into account space permissions.
## Developed by: Davin Studer ## Date created: 10/24/2013 ## @noparams #set ($vPerms = $content.getContentPermissionSet("View")) #set ($ePerms = $content.getContentPermissionSet("Edit")) #set ($viewSize = $vPerms.size()) #set ($editSize = $ePerms.size()) #if(!$viewSize) #set($viewSize = 0) #end #if(!$editSize) #set($editSize = 0) #end #if($viewSize == 0 && $editSize == 0) There are no restrictions set.<br /> #else ################### ## Viewers ## ################### #if ($viewSize > 0) Viewers:<br /> <ul> #foreach($vPerm in $vPerms) #if($vPerm.isGroupPermission()) <li>$vPerm.getGroupName() (Group)</li> #end #end #foreach($vPerm in $vPerms) #if($vPerm.isUserPermission()) <li> $vPerm.getUserSubject().getFullName() (User)</li> #end #end </ul> #else There are no view restrictions set.<br /> #end ################### ## Editors ## ################### #if ($editSize > 0) Editors:<br /> <ul> #foreach($ePerm in $ePerms) #if($ePerm.isGroupPermission()) <li>$ePerm.getGroupName() (Group)</li> #end #end #foreach($ePerm in $ePerms) #if($ePerm.isUserPermission()) <li>$ePerm.getUserSubject().getFullName() (User)</li> #end #end </ul> #else There are no edit restrictions set.<br /> #end #end
This could be expand to show space permissions as well using ... $spaceManager.getSpace($content.spaceKey).getPermissions()
Thank you very much for your input. This is one part of the game, but the space permissions is exactly what we need on top.
ah, great. We are not very good at coding macros at the moment, but i will look into it.
Hi @Davin Studer. I like this macro, but It does not include inherited restrictions
Can it be expanded with this functionality?
It looks like you're new here. Sign in or register to get started.