Thanks!
It works like a charm ;)
You are looking for something like:
#if($xwiki.getUser("XWiki.Admin").isUserInGroup("XWiki.XWikiAllGroup"))
...
#end
Check the API of your XWiki
(
http://platform.xwiki.org/xwiki/bin/download/DevGuide/API/xwiki-core-1.8.1-…),
please.
Here a snippet where the prefix "XWiki." is handled in Velocity. Only the user
login name and group name has to be entered.
Have fun,
Rudi
#if(($request.action) && ($request.action == 'CheckGroupMembership'))
#set($group = "XWiki.${request.group}")
#set($user = "XWiki.${request.user}")
#if($xwiki.getUser($user).isUserInGroup($group))
User $user IS in group $group
#else
User $user IS NOT in group $group
#end
#end
1 Check Group Membership
<form action="$doc.getURL("view")" method="post">
<input type="hidden" name="action" value="null" />
<table>
<tr>
<td>Group:</td>
<td><input type="text" name="group"
value="$!request.group" size="60" /><td>
</tr>
<tr>
<td>User:</td>
<td><input type="text" name="user"
value="$!request.user" size="60" /></td>
</tr>
</table>
<input type="submit" value="Check Group Membership"
onclick="document.getElementById('bequiet').style.visibility='visible';this.form.action.value='CheckGroupMembership'"
/>
<!-- <input type="reset" value="Cancel" /> -->
<div id="bequiet" style="visibility:hidden">
<h1>busy...</h1>
</div>
</form>
Hi
I`m trying to figure a way to check if a user is a member of one group.
I`m looking for something like:
a) retrieve the groups membership of an user in velocity
or
b) check if a user is a member of a specify group.
Thanks in advance
Regards,
Bruno
--
View this message in context:
http://n2.nabble.com/Group-Members-in-Velocity-tp2641137p2652257.html
Sent from the XWiki- Dev mailing list archive at
Nabble.com.