You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by petros <pe...@cypoz.com> on 2008/03/11 06:49:00 UTC

Hide menu items

I have a menu with the following items
MyDetails
UsersList

I want the MyDetails item to be shown all the time and the UsersList to show
only when the user has the roles admin and manager. I am assuming I have a
method called checkAuthorisation(String[]). I know the syntax below is
incorrect but I am looking for something similar to this. Has anyone done
this ? Any ideas ?

<t:if test="checkAuthorisation(new String[]{'admin', 'manager'})">
   UsersList
</t:if>
-- 
View this message in context: http://www.nabble.com/Hide-menu-items-tp15975282p15975282.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Hide menu items

Posted by petros <pe...@cypoz.com>.
Thanks for this Davor, 
I basically copied the code for ListBinding and overwrote the 
public Object get() method and everything works great. 

Petros


Davor Hrg wrote:
> 
> such construct is not yet possible,
> OGNL is not used,
> 
> checkout http://wiki.apache.org/tapestry/Tapestry5HowTos
> for code snippets
> 
> there you have:
> http://wiki.apache.org/tapestry/Tapestry5HowToAddBindingPrefix
> 
> that way you can create a binding prefix checkAuth: and use it:
> <t:if test="checkAuth:admin,manager">
> ....
> 
> 
> try it out you'll be surprised how easy it is :)
> 
> Davor Hrg
> 
> On Tue, Mar 11, 2008 at 6:49 AM, petros <pe...@cypoz.com> wrote:
>>
>>  I have a menu with the following items
>>  MyDetails
>>  UsersList
>>
>>  I want the MyDetails item to be shown all the time and the UsersList to
>> show
>>  only when the user has the roles admin and manager. I am assuming I have
>> a
>>  method called checkAuthorisation(String[]). I know the syntax below is
>>  incorrect but I am looking for something similar to this. Has anyone
>> done
>>  this ? Any ideas ?
>>
>>  <t:if test="checkAuthorisation(new String[]{'admin', 'manager'})">
>>    UsersList
>>  </t:if>
>>  --
>>  View this message in context:
>> http://www.nabble.com/Hide-menu-items-tp15975282p15975282.html
>>  Sent from the Tapestry - User mailing list archive at Nabble.com.
>>
>>
>>  ---------------------------------------------------------------------
>>  To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>  For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Hide-menu-items-tp15975282p16235939.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Hide menu items

Posted by Davor Hrg <hr...@gmail.com>.
such construct is not yet possible,
OGNL is not used,

checkout http://wiki.apache.org/tapestry/Tapestry5HowTos
for code snippets

there you have:
http://wiki.apache.org/tapestry/Tapestry5HowToAddBindingPrefix

that way you can create a binding prefix checkAuth: and use it:
<t:if test="checkAuth:admin,manager">
....


try it out you'll be surprised how easy it is :)

Davor Hrg

On Tue, Mar 11, 2008 at 6:49 AM, petros <pe...@cypoz.com> wrote:
>
>  I have a menu with the following items
>  MyDetails
>  UsersList
>
>  I want the MyDetails item to be shown all the time and the UsersList to show
>  only when the user has the roles admin and manager. I am assuming I have a
>  method called checkAuthorisation(String[]). I know the syntax below is
>  incorrect but I am looking for something similar to this. Has anyone done
>  this ? Any ideas ?
>
>  <t:if test="checkAuthorisation(new String[]{'admin', 'manager'})">
>    UsersList
>  </t:if>
>  --
>  View this message in context: http://www.nabble.com/Hide-menu-items-tp15975282p15975282.html
>  Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>  For additional commands, e-mail: users-help@tapestry.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org