You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Seth Milder <mr...@physics.gmu.edu> on 2003/01/08 23:16:40 UTC

Setting Roles

Hi,

I am wondering what I need to do to set roles for optional content when 
using struts template tags as in

	<template:get name='administratorPanel' role="ADMINISTRATOR" />

Where and how can I set this role? I've googled it and looked through 
the docs but I can only find how to check the role but not to set it.

Thanks for any help with this.

-- 
Seth Milder
Department of Physics and Astronomy
MS 3f3
George Mason University
Fairfax, VA
http://www.mrseth.org
--
"The fact that life has no meaning is a reason to live -- moreover, the 
only one." --E. M. Cioran


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Setting Roles

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

On Wed, 8 Jan 2003, Seth Milder wrote:

> Date: Wed, 08 Jan 2003 17:16:40 -0500
> From: Seth Milder <mr...@physics.gmu.edu>
> Reply-To: Struts Users Mailing List <st...@jakarta.apache.org>
> To: Struts Users Mailing List <st...@jakarta.apache.org>
> Subject: Setting Roles
>
> Hi,
>
> I am wondering what I need to do to set roles for optional content when
> using struts template tags as in
>
> 	<template:get name='administratorPanel' role="ADMINISTRATOR" />
>
> Where and how can I set this role? I've googled it and looked through
> the docs but I can only find how to check the role but not to set it.
>
> Thanks for any help with this.
>

You need to set up <security-constraint> elements in your web.xml file,
and thus enable container managed login to the application.  When the user
is logged in, he or she is assigned a set of roles that the application
can check by calling request.isUserInRole(), and that's what Struts does
for you to enforce the "roles" attribute of a template or an action.

> Seth Milder

Craig


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>