Failed to execute template. Cause: [Access denied when checking [script] access to [xwiki:Collaboratory.UX.HbpSkin.WebHome] for user [xwiki:XWiki.Admin]]. Click on this message for details.

Query Users - HBP Wiki

IAM21 instance, do not create collab nor modify a team, your changes will be lost


Wiki source code of Query Users

Last modified by bougault on 2023/09/28 17:01

Hide last authors
bougault 10.1 1 {{velocity output="no"}}
bougault 3.1 2 #set($query = $services.query.xwql("from doc.object(XWiki.XWikiUsers) as users"))
bougault 1.1 3 #set($users = $query.execute())
bougault 5.1 4 #set($warnings = [])
bougault 10.2 5 #set($userIds = [])
bougault 3.1 6 #foreach($userId in $users)
7 #set($userDoc = $xwiki.getDocument($userId))
8 #set($obj = $userDoc.getObject("XWiki.XWikiUsers"))
9 #set($lastName = $obj.get("last_name"))
10 #if(!$lastName.matches('[A-Z]{1}\.'))
bougault 9.1 11 $warnings.add("user $userId lastname does not match privacy rules")
bougault 3.1 12 #end
bougault 4.1 13 #set($email = $obj.getValue("email"))
bougault 3.1 14 #if($email != "")
bougault 9.1 15 $warnings.add("user $userId email does not match privacy rules")
bougault 3.1 16 #end
bougault 11.4 17 $userIds.add($userId)
bougault 3.1 18 #end
bougault 1.1 19 {{/velocity}}
bougault 5.1 20
21 {{velocity}}
22
23 {{html clean="false"}}
bougault 7.1 24 <ul>
25 #foreach($warning in $warnings)
26 <li>$warning</li>
27 #end
28 </ul>
bougault 10.2 29 <ul>
30 #foreach($user in $userIds)
bougault 11.5 31 <li>$user.replaceFirst('XWiki.', '')</li>
bougault 10.2 32 #end
33 </ul>
bougault 7.1 34 {{/html}}
35 {{/velocity}}