[xwiki-devs] spaces right and navigation panel
I would like to modify navigation panel to list only spaces for wich a user has at least the view access level. How to test the access Level of a user for a space? How to get the current user? Thank for your time.
Hi Antoine, On Tue, Dec 16, 2008 at 1:17 AM, antoine Seilles <[email protected]>wrote: I would like to modify navigation panel to list only spaces for wich a
user has at least the view access level.
How to test the access Level of a user for a space?
A space exists from the moment a page is created in that space. Most of the time, you can check the rights against SpaceName.WebHome or SpaceName.WebPreferences , those are the 2 pages that are the most likely to exist in any given space.
How to get the current user?
$context.user ;-)
Thank for your time.
Please consider adding your snippet on http:/:code.xwiki.org/ once you have it working fine. Guillaume
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Guillaume Lerouge Product Manager - XWiki Skype ID : wikibc http://blog.xwiki.com/
Hi guillaume, thank for your time and tips. I've been on the XWiki api but don't find anything about spaces... http://platform.xwiki.org/xwiki/bin/download/DevGuide/API/xwiki-core-1.7-jav... I think i have to test : SpaceName.WebPreferences.hasAccessLevel("view" , $context.user) Is it correct? I'm going to try this right now. And no problem, i will add my snippet if it works. Guillaume Lerouge a écrit :
Hi Antoine,
On Tue, Dec 16, 2008 at 1:17 AM, antoine Seilles <[email protected]>wrote:
I would like to modify navigation panel to list only spaces for wich a
user has at least the view access level.
How to test the access Level of a user for a space?
A space exists from the moment a page is created in that space. Most of the time, you can check the rights against SpaceName.WebHome or SpaceName.WebPreferences , those are the 2 pages that are the most likely to exist in any given space.
How to get the current user?
$context.user ;-)
Thank for your time.
Please consider adding your snippet on http:/:code.xwiki.org/ once you have it working fine.
Guillaume
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
antoine Seilles a écrit :
Hi guillaume,
thank for your time and tips. I've been on the XWiki api but don't find anything about spaces... http://platform.xwiki.org/xwiki/bin/download/DevGuide/API/xwiki-core-1.7-jav...
I think i have to test :
SpaceName.WebPreferences.hasAccessLevel("view" , $context.user)
Well, in fact, i have a $space . How to get its name and the doc SpaceName.WebPreferences ?
Is it correct? I'm going to try this right now.
And no problem, i will add my snippet if it works.
Guillaume Lerouge a écrit :
Hi Antoine,
On Tue, Dec 16, 2008 at 1:17 AM, antoine Seilles <[email protected]>wrote:
I would like to modify navigation panel to list only spaces for wich a
user has at least the view access level.
How to test the access Level of a user for a space?
A space exists from the moment a page is created in that space. Most of the time, you can check the rights against SpaceName.WebHome or SpaceName.WebPreferences , those are the 2 pages that are the most likely to exist in any given space.
How to get the current user?
$context.user ;-)
Thank for your time.
Please consider adding your snippet on http:/:code.xwiki.org/ once you have it working fine.
Guillaume
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
antoine Seilles wrote:
antoine Seilles a écrit :
Hi guillaume,
thank for your time and tips. I've been on the XWiki api but don't find anything about spaces... http://platform.xwiki.org/xwiki/bin/download/DevGuide/API/xwiki-core-1.7-jav...
I think i have to test :
SpaceName.WebPreferences.hasAccessLevel("view" , $context.user)
Well, in fact, i have a $space . How to get its name and the doc SpaceName.WebPreferences ?
Maybe this helps: http://tinyurl.com/5tf7zl . You can write: #if ($xwiki.checkAccess("${space}.WebPreferences", "view")) ## your code here #end If you need to get the document, you can write: #set($yourDoc = $xwiki.getDocument("${space}.WebPreferences"))
Is it correct? I'm going to try this right now.
And no problem, i will add my snippet if it works.
Guillaume Lerouge a écrit :
Hi Antoine,
On Tue, Dec 16, 2008 at 1:17 AM, antoine Seilles <[email protected]>wrote:
I would like to modify navigation panel to list only spaces for wich a
user has at least the view access level.
How to test the access Level of a user for a space?
A space exists from the moment a page is created in that space. Most of the time, you can check the rights against SpaceName.WebHome or SpaceName.WebPreferences , those are the 2 pages that are the most likely to exist in any given space.
How to get the current user?
$context.user ;-)
Thank for your time.
Please consider adding your snippet on http:/:code.xwiki.org/ once you have it working fine.
Guillaume
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
participants (3)
-
antoine Seilles -
Guillaume Lerouge -
Marius Dumitru Florea