Skip to content

Commit

Permalink
XWIKI-19464: No entry displayed on WikiManager page for an non admin …
Browse files Browse the repository at this point in the history
…user with and error notification and log trace

- Pass the current document to the context
- Skip the failing wikis and log a warning to allow the other wikis to be listed
  • Loading branch information
manuelleduc committed May 10, 2022
1 parent ee3d68c commit 8aa04a3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@
'className': 'XWiki.XWikiServerClass',
'resultPage': 'WikiManager.WikisLiveTableResults',
'translationPrefix': 'platform.wiki.browse.',
'onlyTemplates': '1'
'onlyTemplates': '1',
'$doc' : $doc.fullName
}))
{{liveData
id='wikis'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@
#set ($sourceParameters = $escapetool.url({
'className' : 'XWiki.XWikiServerClass',
'resultPage' : 'WikiManager.WikisLiveTableResults',
'translationPrefix' : 'platform.wiki.browse.'

'translationPrefix' : 'platform.wiki.browse.',
'$doc' : $doc.fullName
}))
{{liveData
id='wikis'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-->

<xwikidoc version="1.1">
<xwikidoc version="1.5" reference="WikiManager.WikisLiveTableResults" locale="">
<web>WikiManager</web>
<name>WikisLiveTableResults</name>
<language/>
Expand All @@ -29,6 +29,7 @@
<creator>xwiki:XWiki.Admin</creator>
<parent>WikiManager.WebHome</parent>
<author>xwiki:XWiki.Admin</author>
<originalMetadataAuthor>xwiki:XWiki.Admin</originalMetadataAuthor>
<contentAuthor>xwiki:XWiki.Admin</contentAuthor>
<version>1.1</version>
<title>$services.localization.render('platform.livetable.results')</title>
Expand All @@ -46,11 +47,19 @@
#set ($extra = "${extra} and doc.name IN (")
#set ($separator = "")
#foreach ($wiki in $services.wiki.getAll())
## XWiki.XWikiComments is a mandatory document that it must exists and we should have acces to it
#set ($testPageReference = $services.model.createDocumentReference($wiki.id, 'XWiki', 'XWikiComments'))
#if ($xwiki.hasAccessLevel('view', $xcontext.user, $testPageReference) || ($services.wiki.user.getUserScope($wiki.id)!='LOCAL_ONLY' &amp;&amp; $services.wiki.user.getMembershipType($wiki.id) != 'INVITE') || $services.wiki.user.hasPendingInvitation($xcontext.userReference, $wiki.id))
#set ($extra = "${extra}${separator}'XWikiServer${stringtool.capitalize($wiki.id)}'")
#set ($separator = ",")
#try("wikisListException")
## XWiki.XWikiComments is a mandatory document that it must exists and we should have acces to it
#set ($testPageReference = $services.model.createDocumentReference($wiki.id, 'XWiki', 'XWikiComments'))
#if ($xwiki.hasAccessLevel('view', $xcontext.user, $testPageReference) ||
($services.wiki.user.getUserScope($wiki.id) != 'LOCAL_ONLY' &amp;&amp; $services.wiki.user.getMembershipType($wiki.id) != 'INVITE') ||
$services.wiki.user.hasPendingInvitation($xcontext.userReference, $wiki.id))
#set ($extra = "${extra}${separator}'XWikiServer${stringtool.capitalize($wiki.id)}'")
#set ($separator = ",")
#end
#end
#if ("$!wikisListException" != '')
$services.logging.getLogger("WikiManager.WikisLiveTableResultsMacros")
.warn("An error occurred while listing wiki [${wiki.id}].", $wikisListException)
#end
#end
#set ($extra = "${extra})")
Expand Down

0 comments on commit 8aa04a3

Please sign in to comment.