Scripting - How to get current user group?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Scripting - How to get current user group?

cburleso

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 [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Scripting - How to get current user group?

Ludovic Dubost

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 [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?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




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws