cogList pages having rights set
Developed by

Jerome, Vincent Massol

Rating
Rate!
0 Votes
LicenseGNU Lesser General Public License 2.1

Description

List all pages having rights set at the page level. This is useful for example on a public wiki to verify that no page allows guest users to perform actions other than view.

On a single wiki

{{velocity}}
#foreach ($page in $xwiki.searchDocuments(", BaseObject as obj, LargeStringProperty as prop, StringProperty as level, IntegerProperty as allow where obj.name=doc.fullName and obj.className='XWiki.XWikiRights' and obj.id=prop.id.id and prop.id.name='users'  and prop.value='XWiki.XWikiGuest' and level.id.id=obj.id and level.id.name='levels' and level.value<>'view' and allow.id.id=obj.id and allow.id.name='allow' and allow.value=1 order by doc.creationDate desc"))
  * [[$page]]
#end
{{/velocity}}

On a Wiki Farm

{{velocity}}
#foreach($db in $xwiki.getXWiki().getVirtualWikisDatabaseNames($context.context))
  $context.context.setDatabase($db)
  * $db
  #foreach ($page in $xwiki.searchDocuments(", BaseObject as obj, LargeStringProperty as prop, StringProperty as level, IntegerProperty as allow where obj.name=doc.fullName and obj.className='XWiki.XWikiRights' and obj.id=prop.id.id and prop.id.name='users'  and prop.value='XWiki.XWikiGuest' and level.id.id=obj.id and level.id.name='levels' and level.value<>'view' and allow.id.id=obj.id and allow.id.name='allow' and allow.value=1 order by doc.creationDate desc"))
    ** [[$db:$page]]
  #end
#end
$context.context.setDatabase("xwiki")
{{/velocity}}

Prerequisites & Installation Instructions

Copy the code snippet to a page and save it.

Created by Vincent Massol on 2011/03/17 19:22
     

Get Connected