Scripting - How to get current user group?
Does anyone know how, through scripting, we may be able to identify that a user is in a particular group? Here's what I am trying to do: I want to permission some wiki spaces to particular groups only. But I also need to have some pages link to those spaces that are more public. I would like to write some script to render or hide links based on whether or not the authenticated user is in a given group. Thanks in advance for your help, and thanks for all the help given thus far. ================================== Cody Burleson
There isn't an api yet.. and there should be.. In the mean time the following script works with XWiki Group management #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 Cody Burleson wrote:
Does anyone know how, through scripting, we may be able to identify that a user is in a particular group? Here's what I am trying to do:
I want to permission some wiki spaces to particular groups only. But I also need to have some pages link to those spaces that are more public. I would like to write some script to render or hide links based on whether or not the authenticated user is in a given group.
Thanks in advance for your help, and thanks for all the help given thus far.
================================== Cody Burleson ------------------------------------------------------------------------
-- You receive this message as a subscriber of the [email protected] mailing 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
-- Ludovic Dubost XPertNet: http://www.xpertnet.fr/ Blog: http://www.ludovic.org/blog/ XWiki: http://www.xwiki.com Skype: ldubost AIM: nvludo Yahoo: ludovic
participants (2)
-
Cody Burleson -
Ludovic Dubost