You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Siggelkow, Bill" <bi...@mirant.com> on 2003/02/12 19:59:58 UTC

Incorrect assumption with logic:present role attribute

I have an app where I have created my own RequestProcessor to override the processRoles functionality.  Specifically, my roles take into account certain session information.  This works as expected and properly handles the 'roles' attribute in my action mappings.  However, I naievly (sp?) made the assumption that the role attribute of the logic:present tag would use this same functionality -- but it doesn't.  It seems that the <logic:present role="somerole"> only does a request.isUserInRole("somerole") -- it seems to me that if I override the processing of roles it should affect both the action mappings as well as the logic tags (and any other Struts tags) that use the 'role' attribute.  Has this been considered?

Bill Siggelkow
678.579.6458
Mirant
http://www.mirant.com


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Incorrect assumption with logic:present role attribute

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Wed, 12 Feb 2003, Siggelkow, Bill wrote:

> Date: Wed, 12 Feb 2003 13:59:58 -0500
> From: "Siggelkow, Bill" <bi...@mirant.com>
> Reply-To: Struts Users Mailing List <st...@jakarta.apache.org>
> To: "'struts-user@jakarta.apache.org'" <st...@jakarta.apache.org>
> Subject: Incorrect assumption with logic:present role attribute
>
> I have an app where I have created my own RequestProcessor to override
> the processRoles functionality.  Specifically, my roles take into
> account certain session information.  This works as expected and
> properly handles the 'roles' attribute in my action mappings.  However,
> I naievly (sp?) made the assumption that the role attribute of the
> logic:present tag would use this same functionality -- but it doesn't.
> It seems that the <logic:present role="somerole"> only does a
> request.isUserInRole("somerole") -- it seems to me that if I override
> the processing of roles it should affect both the action mappings as
> well as the logic tags (and any other Struts tags) that use the 'role'
> attribute.  Has this been considered?
>

You are correct that <logic:present role="..."> does a
request.isUserInRole() lookup.  That is precisely what it is for -- so
that you can conditionally render things based on what roles the current
user has.

In addition, the standard RequestProcessor treats the "roles" attribute on
an <action> exactly the same way -- it does an isUserInRole() to ensure
that the current user has the required role to execute this action.  Thus,
both pieces of Struts use roles in the same way.

If your custom RequestProcessor changes the semantics of what "roles"
means on the <action> element, then you should probably also provide your
own custom tags to reflect these semantics on the JSP page.

> Bill Siggelkow

Craig

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org