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

Hide last authors
bougault 28.1 1 {{velocity}}
bougault 16.1 2 #set($counter = 0)
bougault 21.1 3 #set($dateStart = $datetool.getSystemTime())
bougault 25.2 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"))
bougault 15.27 6 #set($users = $query.execute())
bougault 15.25 7
bougault 15.24 8 #foreach($userId of $users)
bougault 25.2 9 #set($modif = 0)
bougault 15.25 10 #set($userDoc = $xwiki.getDocument($userId))
11 #set($obj = $userDoc.getObject("XWiki.XWikiUsers"))
bougault 31.1 12 #set($email = $obj.get("email"))
bougault 32.1 13 x $email
bougault 33.1 14 x $email
15 #if($email)
bougault 30.1 16 change email
bougault 25.2 17 #set($modif = 1)
18 $obj.set("email", "")
19 #end
bougault 15.28 20 #set($lastName = $obj.get("last_name"))
bougault 27.1 21 #if($lastName && $lastName != "" && !$lastName.matches('[A-Z]{1}\.'))
bougault 30.1 22 change lastname
bougault 25.2 23 #set($modif = 1)
bougault 15.28 24 $obj.set("last_name", $lastName.substring(0,1).toUpperCase().concat("."))
25 #end
bougault 16.1 26 ##$userId
bougault 29.1 27 #if($modif == 1)
bougault 25.2 28 #set($counter = $counter + 1)
29 $userDoc.save()
30 #end
bougault 15.24 31 #end
bougault 16.1 32
bougault 21.1 33 #set($dateEnd = $datetool.getSystemTime())
bougault 16.1 34 #set($duration = $datetool.difference($dateStart, $dateEnd))
bougault 1.1 35 {{/velocity}}
bougault 18.1 36
bougault 23.1 37 {{velocity}}
bougault 19.1 38
bougault 22.1 39 {{html clean="false"}}
bougault 24.1 40 <p>Updated $counter users in $duration</p>
bougault 18.1 41 {{/html}}
bougault 23.1 42
43 {{/velocity}}