struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nadeem Bitar <na...@izucode.com>
Subject Re: Role based access?
Date Wed, 18 Feb 2004 20:11:20 GMT
processRoles method is in RequestProcessor.
You would do something like this:

boolean processRoles(HttpServletRequest request, HttpServletResponse
response, ActionMapping mapping) throws Exception{
 String[] roles = mapping.getRoleNames();
 if(roles == null || roles.length == 0)
	return true
  for(int i=0; i<roles.length; i++){
	//check if the current user is in any of the specified roles
        //using your custom security scheme usually something like that
        if(request.isUserInRole(roles[i]))
		return true;
  }
  return false;

}
On Thu, 2004-02-19 at 01:26 +0530, subramaniam.o@tcs.com wrote:
> Hi, 
> Thanks for the info Nadeem.but processRoles method is in which Class. 
> could you give me some samples. 
> Thanks in advance 
> 
> 
> Subramaniam Olaganthan
> Tata Consultancy Services
> Mailto: subramaniam.o@tcs.com
> Website: http://www.tcs.com 
> 
> 
> Nadeem Bitar <nadim@izucode.com> 
> 
> 02/19/2004 12:59 AM 
>          Please respond to
>     "Struts Users Mailing List"
>  <struts-user@jakarta.apache.org>
> 
> 
>                To
> Struts Users
> Mailing List
> <struts-
> user@jakarta.
> apache.org> 
>                cc
>           Subject
> Re: Role based
> access?
> 
> 
> 
> You have to use JAAS. If you are not using JAAS and still want to use
> the roles attribute in your action mapping you have to override the
> processRoles method .
> 
> 
> On Wed, 2004-02-18 at 20:49 +0530, subramaniam.o@tcs.com wrote:
> > Hi Guys, 
> > 
> > Struts-config.xml 
> >                 <action attribute="Form"   roles="userRole"> 
> > 
> > How do i use this 'roles' attribute to implement role-based access. 
> > 
> > Thanks and Regards 
> > 
> > Subramaniam Olaganthan
> > Tata Consultancy Services
> > Mailto: subramaniam.o@tcs.com
> > Website: http://www.tcs.com
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 
> 
> ForwardSourceID:NT00003A5E     
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org


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


Mime
View raw message