Conditionally displaying content on the landing page depending on access rights

2 Messages Forum Options Options
Embed this topic
Permalink
Alban Schmid
Conditionally displaying content on the landing page depending on access rights
Reply Threaded MoreMore options
Print post
Permalink
Dear fellow xwiki users,

 

I'd like to display some portions of the landing page as well as some items in the menu conditionally, i.e. only for some specific groups.

 

I've found following code snippet on the 'Quick Links' menu:

 

#if ($xwiki.hasAdminRights())

Content to display conditionally

#end

 

Is there a way to adapt this so as to restrict display not to AdminRights, but e.g. to 'EditRights' or group rights?

 

I'd like to do something like this (pseudo-code)

 

#if ($xwiki.isMemberOfAdmin() or $xwiki.isMemberOfInternalUsers())

Content to display conditionally

#end

 

Thanks for your answer.

 

Regards,

 

 

 

ALBAN SCHMID
CLIENT SOLUTIONS SPECIALIST

DIRECTOR, CHANNEL SOLUTION SERVICES
CBS Interactive - Channel
Tel: +41 21 943 03 86

Skype: albanschmid
Rte Industrielle 2 | CP 138 | 1806 St-Légier, Switzerland
CNETChannel.com

 

_______________________________________________
users mailing list
users@...
http://lists.xwiki.org/mailman/listinfo/users
Thomas Mortagne
Re: Conditionally displaying content on the landing page depending on access rights
Reply Threaded MoreMore options
Print post
Permalink
On Wed, Oct 15, 2008 at 1:44 PM, Alban Schmid
<Alban.Schmid@...> wrote:

> Dear fellow xwiki users,
>
>
>
> I'd like to display some portions of the landing page as well as some items in the menu conditionally, i.e. only for some specific groups.
>
>
>
> I've found following code snippet on the 'Quick Links' menu:
>
>
>
> #if ($xwiki.hasAdminRights())
>
> Content to display conditionally
>
> #end
>
>
>
> Is there a way to adapt this so as to restrict display not to AdminRights, but e.g. to 'EditRights' or group rights?
>
>
>
> I'd like to do something like this (pseudo-code)
>
>
>
> #if ($xwiki.isMemberOfAdmin() or $xwiki.isMemberOfInternalUsers())
>
> Content to display conditionally
>
> #end

You have $xwiki.hasAccessLevel("right") for current page. See
http://tinyurl.com/18r.

For example for edit right it's : $xwiki.hasAccessLevel("edit")

In general when you search for methods in api, look at
http://platform.xwiki.org/xwiki/bin/view/DevGuide/API.

>
>
>
> Thanks for your answer.
>
>
>
> Regards,
>
>
>
>
>
>
>
> ALBAN SCHMID
> CLIENT SOLUTIONS SPECIALIST
>
> DIRECTOR, CHANNEL SOLUTION SERVICES
> CBS Interactive - Channel
> Tel: +41 21 943 03 86
>
> Skype: albanschmid
> Rte Industrielle 2 | CP 138 | 1806 St-Légier, Switzerland
> CNETChannel.com
>
>
>
> _______________________________________________
> users mailing list
> users@...
> http://lists.xwiki.org/mailman/listinfo/users
>



--
Thomas Mortagne
_______________________________________________
users mailing list
users@...
http://lists.xwiki.org/mailman/listinfo/users