List Pages With Rights
Last modified by Vincent Massol on 2021/03/18 11:28
![]() | List pages having rights set |
Type | Snippet |
Category | |
Developed by | |
Rating | |
License | GNU Lesser General Public License 2.1 |
Table of contents
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}}
#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}}
#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}}