Hi,
I'm relatively new to xwiki. I have a few pages where dynamic tables had to
be shown, and I'm using PHP quite heavily there. In a couple of pages, the
content is supposed to be shown only if the user is in a specific group
called 'XWikiEditorsGroup'. I didn't want to rely on xwiki's native
single-page permissions as they looked a little cumbersome for what I
needed, and preferred to control access via the page code itself. Up to
xwiki 2.7, the following velocity section, which was the first section in
the page, did the trick:

{{velocity}}
#set($user=$xwiki.getUser())
#if(!$user.isUserInGroup("XWiki.XWikiEditorsGroup"))
  {{warning}}You don't have permission to view this document{{/warning}}
  #stop
#end
{{/velocity}}

However, after upgrading to xwiki 3.0, this code no longer works. From what
I see, the issue appears to be related to velocity 1.7 and its different
syntax for the #stop directive. I can't seem to find the right syntax
though. As an alternative approach, I've also tried to relocate this access
control logic into the PHP code that follows the above velocity section. To
do that, I need to find a way to get the true/false value of
"$user.isUserInGroup("XWiki.XWikiEditorsGroup")" in PHP, but so far haven't
found a way to do that either and not sure how to pass the $user object and
its isUserInGroup() method to the PHP part. I've even looked into doing this
in groovy but no luck there either.

Any advice will be appreciated...

Thanks
_______________________________________________
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to