spaces right and navigation panel

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

spaces right and navigation panel

natoine
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.
_______________________________________________
devs mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/devs
Reply | Threaded
Open this post in threaded view
|

Re: spaces right and navigation panel

Guillaume Lerouge
Hi Antoine,

On Tue, Dec 16, 2008 at 1:17 AM, antoine Seilles
<[hidden email]>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
> [hidden email]
> http://lists.xwiki.org/mailman/listinfo/devs
>



--
Guillaume Lerouge
Product Manager - XWiki
Skype ID : wikibc
http://blog.xwiki.com/
_______________________________________________
devs mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/devs
Reply | Threaded
Open this post in threaded view
|

Re: spaces right and navigation panel

natoine
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-javadoc.zip/index.html

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
> <[hidden email]>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
>> [hidden email]
>> http://lists.xwiki.org/mailman/listinfo/devs
>>
>>    
>
>
>
>  

_______________________________________________
devs mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/devs
Reply | Threaded
Open this post in threaded view
|

Re: spaces right and navigation panel

natoine
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-javadoc.zip/index.html
>
> 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
>> <[hidden email]>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
>>> [hidden email]
>>> http://lists.xwiki.org/mailman/listinfo/devs
>>>
>>>    
>>>      
>>
>>  
>>    
>
> _______________________________________________
> devs mailing list
> [hidden email]
> http://lists.xwiki.org/mailman/listinfo/devs
>  

_______________________________________________
devs mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/devs
Reply | Threaded
Open this post in threaded view
|

Re: spaces right and navigation panel

Marius Dumitru Florea
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-javadoc.zip/index.html
>>
>> 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
>>> <[hidden email]>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
>>>> [hidden email]
>>>> http://lists.xwiki.org/mailman/listinfo/devs
>>>>
>>>>    
>>>>      
>>>  
>>>    
>> _______________________________________________
>> devs mailing list
>> [hidden email]
>> http://lists.xwiki.org/mailman/listinfo/devs
>>  
>
> _______________________________________________
> devs mailing list
> [hidden email]
> http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________
devs mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/devs