Wiki source code of Query Users
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | {{velocity}} | ||
| 2 | #set($query = $services.query.xwql("from doc.object(XWiki.XWikiUsers) as users")) | ||
| 3 | #set($users = $query.execute()) | ||
| 4 | #set($warnings = []) | ||
| 5 | #foreach($userId in $users) | ||
| 6 | #set($userDoc = $xwiki.getDocument($userId)) | ||
| 7 | #set($obj = $userDoc.getObject("XWiki.XWikiUsers")) | ||
| 8 | #set($lastName = $obj.get("last_name")) | ||
| 9 | #if(!$lastName.matches('[A-Z]{1}\.')) | ||
| 10 | $warnings.add("user $userId lastname does not match privacy rules") | ||
| 11 | #end | ||
| 12 | |||
| 13 | #set($email = $obj.getValue("email")) | ||
| 14 | #if($email != "") | ||
| 15 | $warnings.add("user $userId email does not match privacy rules") | ||
| 16 | #end | ||
| 17 | #end | ||
| 18 | $warnings | ||
| 19 | {{/velocity}} | ||
| 20 | |||
| 21 | {{velocity}} | ||
| 22 | |||
| 23 | {{html clean="false"}} | ||
| 24 | <ul> | ||
| 25 | #foreach($warning in $warnings) | ||
| 26 | <li>$warning</li> | ||
| 27 | #end | ||
| 28 | </ul> | ||
| 29 | {{/html}} | ||
| 30 | {{/velocity}} |