You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Jagadeesan,Sivakumar" <si...@dhs.state.tx.us> on 2003/03/27 21:50:03 UTC

Actions based on Role

I have web application where users could of three types (Roles)

1) Basic User
2) Silver User
3) Gold User

According to Type / Role of user some actions could be performed or not
performed.

I could set in my stuts-config.xml, the role based access in Action Element 

I am having my own authentication System that uses the database . The User
table has the userName and also the Role.

I am not sure how could I create a Role that the Action is expecting , if I
am using my own authentication

Thanx
--Siva Jagadeesan

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


Re: Actions based on Role

Posted by Jason Lea <ja...@kumachan.net.nz>.
Jagadeesan,Sivakumar wrote:
> I have web application where users could of three types (Roles)
> 
> 1) Basic User
> 2) Silver User
> 3) Gold User
> 
> According to Type / Role of user some actions could be performed or not
> performed.
> 
> I could set in my stuts-config.xml, the role based access in Action Element 
> 
> I am having my own authentication System that uses the database . The User
> table has the userName and also the Role.
> 
> I am not sure how could I create a Role that the Action is expecting , if I
> am using my own authentication

"Struts in Action", ch 9, pg 260-261
9.2.2 ProcessRoles

This shows how you can override the processRoles() method of 
RequestProcessor.  It provides you with the request, response and action 
mapping.  So you can get the roles in the struts-config.xml for the 
Action using mapping.getRoleNames().  You can the check that the user 
has one of the roles and return true or false.

Jason Lea


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