Created
January 19, 2017 18:54
-
-
Save sdumitriu/67d6ce60dc977c525196f61a0b51f997 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{html clean="false"}} | |
<form action="" method="POST"> | |
<fieldset> | |
<legend>Check a user's activity and collaborations</legend> | |
<input type="text" name="uid" class="suggestUsers"/> <span class="buttonwrapper"><input type="submit" value="Check" class="button"/></span> | |
</fieldset> | |
{{/html}} | |
{{velocity}} | |
#if ("$!request.uid" != '') | |
#set ($ruid = $services.model.resolveDocument($request.uid, 'user/current').toString()) | |
#set ($duid = "{{html}}$xwiki.getUserName($ruid){{/html}} ($ruid)") | |
#set ($owendByUser = $services.query.hql(', BaseObject o, StringProperty p where o.name = doc.fullName and p.id.id = o.id and p.id.name = ''owner'' and p.value = :uid').bindValue('uid', $ruid).execute()) | |
#set ($sharedWithUser = $services.query.hql(', BaseObject o, StringProperty p where o.name = doc.fullName and p.id.id = o.id and p.id.name = ''collaborator'' and p.value = :uid').bindValue('uid', $ruid).execute()) | |
#set ($groups = $services.query.hql(', BaseObject o, StringProperty p where o.name = doc.fullName and p.id.id = o.id and p.id.name = ''member'' and p.value = :uid').bindValue('uid', $ruid).execute()) | |
#set ($mentions = $mathtool.add($mathtool.add($owendByUser.size(), $sharedWithUser.size()), $groups.size())) | |
#if ($owendByUser.size() > 0) | |
{{warning}}$duid owns $owendByUser.size() patient records: | |
#foreach ($e in $owendByUser) | |
* [[$e]] | |
#end | |
{{/warning}} | |
#end | |
#if ($sharedWithUser.size() > 0) | |
{{warning}}$duid is a collaborator for $sharedWithUser.size() patient records: | |
#foreach ($e in $sharedWithUser) | |
* [[$e]] | |
#end | |
{{/warning}} | |
#end | |
#if ($groups.size() > 0) | |
{{warning}}$duid is part of $groups.size() groups: | |
#foreach ($e in $groups) | |
* [[$e]] | |
#end | |
{{/warning}} | |
#end | |
#if ($mentions == 0) | |
{{info}}$duid appears isolated and inactive, may be safe to delete.{{/info}} | |
#end | |
#end | |
{{/velocity}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment