This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.

Simple way to test isUserInRole within expression

Oct 17th, 2012, 06:08 PM

Hi,
I was wondering if there's anything built-in to webflow allowing access to test user's roles;
I'm aware of the "secured" attribute on a flow, but what I'm really interested in here is a way to evaluate whether a user is in a given role from an EL expression.

Right now, I'm doing "externalContext.nativeRequest.isUserInRole('THE_R OLE')"...is there a better/recommended way to do this without delegating to the native request?
( I noticed that just using "externalContext.isUserInRole('THE_ROLE')" always returns false, regardless of whether the user is in the role or not )

The more general scope is that I'm trying to define a decision/action state at the beginning of a flow which sends the user to a different initial view state depending on whether they are in a particular role.