tiles-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Antonio Petrelli" <antonio.petre...@gmail.com>
Subject Re: "role" attribute not taken into account?
Date Thu, 20 Mar 2008 10:17:07 GMT
2008/3/20, Daniel Baldes <db@open.ch>:
>
> Hi,
>
> I got a definition in tiles.xml like this:
>
>    <definition name="menu" template="menu.jsp"  >
>       <put-list-attribute name="items">
>        <add-attribute value="a" role="one-role" />
>        <add-attribute value="b" role="second-role" />
>        <add-attribute value="c" role="third-role" />
>       </put-list-attribute>
>    </definition>
>
> In menu.jsp I do <tiles:importAttribute /> and then iterate over $items
> in a c:forEach. I always get all attributes, regardless of what roles
> the current user is in.
>
> I use tiles 2.0.5 (I found a bug report which described this problem,
> but it is marked as fixed for 2.0.5:
> https://issues.apache.org/struts/browse/TILES-185 ).
>
> Is this a bug or am I doing something wrong?
>
> (tiles 2.0.5, struts 2.0.11 with tiles-plugin, tomcat 6.0.16)



The "role" property is evaluated only when you use <tiles:insertAttribute>.
This means that in the list, the element specified with <add-attribute> is
always put.
In your case, probably you have to check the role manually (by checking the
user's role against the iterated element, that is of class "Attribute"). Or
you have to use <tiles:insetAttribute> with the "value" attribute evaluated
with the iterated item in the list.

HTH
Antonio

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message