Make sure to add in the space, otherwise it won't know what group you're
referring to:
$user.isUserInGroup("XWikiAdminGroup") should read
$user.isUserInGroup("XWiki.XWikiAdminGroup").  

Note that there is an easier way to get admin rights though; by using
"hasAdminRights()".  Otherwise use the isUserInGroup

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Vitantonio Messa
Sent: 26 October 2007 11:56
To: XWiki Users
Subject: Re: [xwiki-users] isUserInGroup

Hi Ricardo,

you need to call it from an user object, hence:
  - #set ($user = $xwiki.getUser())  ## to retrieve the current user, or
getUser("XWiki.UserName") to retrieve any user
  - $user.isUserInGroup("XWikiAdminGroup") ## to check if this user is
in the admin group

I didn't try the code, but it should work fine.

Vito




Your XEN ICT Team - Ricardo Rodriguez wrote:
> Hi all,
> 
> Please, could you help me to find the right syntax to check if an user

> belongs to a given group?
> 
> I've been playing with the isUserInGroup method without success.
> 
> Thank you so much,
> 
_______________________________________________
users mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________
users mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to