You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Łukasz Budnik <lu...@gmail.com> on 2008/03/10 20:39:54 UTC

visibleOnUserRole error

Hi All!

I have a problem using Tomahawk visibleOnUserRole attribute.
It seems it does not work at all.

Given simple code:

before
<t:div visibleOnUserRole="viewer">I'm a viewer!!</t:div>
<t:div visibleOnUserRole="executor">I'm an executor!!</t:div>
<t:div visibleOnUserRole="admin">I'm an admin!!</t:div>
<t:div>works</t:div>
after

When I sign in as a user 'xh' that has 'viewer' and 'executor' roles,
the result is:

before
works
after

expected:

after
I'm a viewer!!
I'm an executor!!
works
before

The JAAS works for sure I wrote a simple TestFilter and overrode the
doFilter method, I have:

String[] roles = new String[] { "viewer", "executor", "admin" };

for (String role : roles) {
	logger.debug("Is user in '" + role + "' role? ==> "
	+ ((HttpServletRequest) request).isUserInRole(role));
}

logger.debug(((HttpServletRequest) request).getUserPrincipal().getName());

and the result is:

19:50:46,109 DEBUG [TestFilter] Is user in 'viewer' role? ==> true
19:50:46,109 DEBUG [TestFilter] Is user in 'executor' role? ==> true
19:50:46,109 DEBUG [TestFilter] Is user in 'admin' role? ==> false
19:50:46,109 DEBUG [TestFilter] xh

so, clearly there is some kind of error in Tomahawk.

I'm using MyFaces 1.2 and Tomahawk 1.1.7-SNAPSHOT. My app is deployed on
Apache Geronimo application server.

any ideas?

best regards
Łukasz