You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tiles.apache.org by Eric B <eb...@hotmail.com> on 2013/10/30 02:40:03 UTC

How to use Tiles roles in templates?

I'm trying to figure out how I can use template roles to use different template definitions for different roles in my system.  I'm using Spring 3.2.4 
with Spring Security and Tiles 3.0.x.

I see that in the template definitions, there is a "role" attribute.  Is there anyway I can tie in the Spring Security roles to the Tiles roles?  ie: 
given a specific Spring Security role, only have specific templates available.

This would avoid me having to use if/else statements in my templates to determine which sections should be available for which roles.

Thanks,

Eric


Re: How to use Tiles roles in templates?

Posted by Mck <mc...@apache.org>.
> I'm trying to figure out how I can use template roles to use different template definitions for different roles in my system.  I'm using Spring 3.2.4 
> with Spring Security and Tiles 3.0.x.
> 
> I see that in the template definitions, there is a "role" attribute.  Is there anyway I can tie in the Spring Security roles to the Tiles roles?  ie: 
> given a specific Spring Security role, only have specific templates available.

Eric,
 i'm not familar with the use of roles in Tiles.
 These roles are connected to the container managed security,
httpServletRequest.isUserInRole(..)


In the code you see this in action in

Attribute.isPermitted(request) which is called from
BasicTilesContainer.render(..)


So as long as request.isUserInRole(..) is working for you then so should
Tiles security.

~mck