[xwiki-users] How to know wether current user has right to some document?
Hello experts, I and stats to some page,the code is as following: #if($xwiki.statsService.enabled) {{include document="Stats.Document"/}} #end it works,but when I log out, there is error message : Caused by: org.xwiki.rendering.macro.MacroExecutionException: Current user doesn't have view rights on document [Stats.Document] at org.xwiki.rendering.internal.macro.include.IncludeMacro.execute(IncludeMacro.java:139) So how can I add rights permission code? Thansk & Best Regards Tom
tom li wrote:
Hello experts,
I and stats to some page,the code is as following:
#if($xwiki.statsService.enabled) {{include document="Stats.Document"/}} #end
it works,but when I log out, there is error message :
Caused by: org.xwiki.rendering.macro.MacroExecutionException: Current user doesn't have view rights on document [Stats.Document] at org.xwiki.rendering.internal.macro.include.IncludeMacro.execute(IncludeMacro.java:139)
So how can I add rights permission code?
See http://tinyurl.com/y9w6u7l . You could try: #if($xwiki.hasAccessLevel("view", $context.user, "Stats.Document") && $xwiki.statsService.enabled) {{include document="Stats.Document"/}} #end Hope this helps, Marius
Thansk & Best Regards
Tom _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
participants (2)
-
Marius Dumitru Florea -
tom li