How do you flush the cache? Thanks Duke On 6/14/06, Robinson Nathaniel <[email protected]> wrote:
Apparently this feature is "missing" in 0.9.840. I don't know what's in the source versions now.
I got around this problem by assigning privileges for the group to a page, and then checking for access to that page (less code).
Ludovic sent me the following script, which I believe is a more direct answer to your question:
Currently there is no xwiki API for groups (it's missing).. But this works:
#set($ismember = false) #set($groupdoc = $xwiki.getDocument("XWiki.MyGroup")) #set($memberobj = $groupdoc.getObjects("XWiki.XWikiGroups")) #foreach($mobj in $memberobj) #set ($member = $groupdoc.display("member", "view", $mobj)) #if($member == $context.user) #set($ismember = true) #end #end
#if($ismember==true) do your stuff #end
Don't forget to flush the cache after changing the members in a group. It's another "bug" in 0.9.840.
Good luck!
-Nate
-----Original Message----- From: Jeff Ousley [mailto:[email protected]] Sent: Wednesday, June 14, 2006 7:12 AM To: [email protected] Subject: [xwiki-users] check for group membership
Hello,
Is there a way via velocity to check whether or not a user has membership in a particular group? Could someone provide or point me to examples of this.
Thanks! -jeff
-- You receive this message as a subscriber of the [email protected] list. To unsubscribe: mailto:[email protected] For general help: mailto:[email protected]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws