Show global users in subwiki user directory

Hello,

I have several subwikis without any local users (only global users can access). The user directory in the main wiki shows all users as expected, but is it possible to change the user directory page of the subwikis to show the global users? At the moment only an empty list is shown.

I tried to make my own user directory page with the following code:

1st option:

{{liveData id="users" properties="last_name,first_name,ibs_abbrev,ibs_comp,ibs_dep" source="liveTable" sourceParameters="className=xwiki:XWiki.XWikiUsers&translationPrefix=xe.userdirectory." limit="100"/}}

2nd option:

{{liveData id="users2" properties="last_name,first_name,ibs_abbrev,ibs_comp,ibs_dep" source="liveTable" sourceParameters="resultPage=xwiki:XWiki.LiveTableResults&className=xwiki:XWiki.XWikiUsers&translationPrefix=xe.userdirectory." limit="100"/}}

but both options show only an empty list. Both options use the correct XWikiUsers class of the main wiki, because only there I have added some custom properties with static lists and they are shown in the table filters.

With the livetable macro I could manage to get the user list, but the translation of the column headers doesn’t work

{{velocity}}
#set($columns = ["last_name", "first_name", "ibs_abbrev", "ibs_comp", "ibs_dep"])
#set($columnsProperties = {
    "last_name" : { "type" : "text", "link" : "view"},
    "first_name" : { "type" : "text", "link" : "view"},
    "ibs_abbrev" : { "type" : "text", "html" : "true"},
    "ibs_comp" : { "type" : "text", "html" : "true"},
    "ibs_dep" : { "type" : "text", "html" : "true"}
})
#set($options = { 
   "url" : "$xwiki.getURL('xwiki:XWiki.LiveTableResults', 'get', 'outputSyntax=plain&transprefix=xe.userdirectory.&classname=XWiki.XWikiUsers&collist=last_name,first_name,ibs_abbrev,ibs_comp,ibs_dep')",
   "translationPrefix" : "xe.userdirectory.",
   "tagCloud" : true,
   "rowCount": 100
})
#livetable("userdirectory" $columns $columnsProperties $options)
{{/velocity}}

image

Any ideas what I can do?

BR Andreas

I found a solution for my problem (maybe more a dirty hack than a solution :slight_smile: ).

In the main wiki I did the following modification of the “/bin/view/XWiki/UserDirectoryMacros” page:

replaced all $xcontext.database with $xcontext.mainWikiName

Then I modified the Subwiki “/view/Main/UserDirectory” page and changed “XWiki.UserDirectoryMacros” to “xwiki:XWiki.UserDirectoryMacros”

short update to the previous posted solution. I added some static list properties to the XWiki.XWikiUsers class and with the posted solution the list entries were not shown in the table filter.
To solve this I again changed the “/bin/view/XWiki/UserDirectoryMacros” page of the main wiki and replaced

‘className’: $services.model.serialize($xwikiUsersClassReference, ‘local’),

with

‘className’: ‘xwiki:XWiki.XWikiUsers’,

BR, Andreas

Thanks for replying and posting your solution, that will help others!