You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tiles.apache.org by Sivaswamynatha K <k....@Kavniya.com> on 2007/06/08 10:51:32 UTC

user roles in tiles.

I want to use user roles in tiles. How to use the user roles in tiles? I
add role attribute in my tiles-def.xml for menus. I have separate jsp
for listing this menu. How can I show and hide menus based on the user
role? Whether I have to write any code in this jsp also. Please help me.

 

Regards,

K. Siva Swamynatha.


Re: user roles in tiles.

Posted by Antonio Petrelli <an...@gmail.com>.
2007/6/8, Sivaswamynatha K <k....@kavniya.com>:
> I want to use user roles in tiles. How to use the user roles in tiles? I
> add role attribute in my tiles-def.xml for menus. I have separate jsp
> for listing this menu. How can I show and hide menus based on the user
> role? Whether I have to write any code in this jsp also. Please help me.

The roles used in Tiles refer to the possibility to show or not to
show a definition.
(In fact, the same should be available for attributes, but for some
reasons it is not evaluated at all, probably it's a bug, hey thank you
:-) )
The role is the role specified with JAAS. If you want your way of
managing roles, I think that you need to create your specific
implementation of TilesRequestContext (and TilesContextFactory).

For example, if you specify a definition this way:

<definition name="my.definition" role="customer">
<!-- attributes-->
</definition>

If you want more control, you can use the "Request" taglib from
Jakarta Taglibs (though it seems to be deprecated):
http://jakarta.apache.org/taglibs/doc/request-doc/request-1.0/index.html#isUserInRole

You can consider using Dimensions, but you have to wait that a release
for Tiles 2 is created:
http://mutidimensions.sf.net/

HTH a bit
Antonio