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.

XWiki Users - HBP Wiki

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


Wiki source code of XWiki Users

Version 33.1 by bougault on 2022/12/20 14:40

Show last authors
1 {{velocity}}
2 #set($counter = 0)
3 #set($dateStart = $datetool.getSystemTime())
4 ##set($query = $services.query.xwql("from doc.object(XWiki.XWikiUsers) as users where users.email <> ''"))
5 #set($query = $services.query.xwql("from doc.object(XWiki.XWikiUsers) as users"))
6 #set($users = $query.execute())
7
8 #foreach($userId of $users)
9 #set($modif = 0)
10 #set($userDoc = $xwiki.getDocument($userId))
11 #set($obj = $userDoc.getObject("XWiki.XWikiUsers"))
12 #set($email = $obj.get("email"))
13 x $email
14 x $email
15 #if($email)
16 change email
17 #set($modif = 1)
18 $obj.set("email", "")
19 #end
20 #set($lastName = $obj.get("last_name"))
21 #if($lastName && $lastName != "" && !$lastName.matches('[A-Z]{1}\.'))
22 change lastname
23 #set($modif = 1)
24 $obj.set("last_name", $lastName.substring(0,1).toUpperCase().concat("."))
25 #end
26 ##$userId
27 #if($modif == 1)
28 #set($counter = $counter + 1)
29 $userDoc.save()
30 #end
31 #end
32
33 #set($dateEnd = $datetool.getSystemTime())
34 #set($duration = $datetool.difference($dateStart, $dateEnd))
35 {{/velocity}}
36
37 {{velocity}}
38
39 {{html clean="false"}}
40 <p>Updated $counter users in $duration</p>
41 {{/html}}
42
43 {{/velocity}}