Call a setter for the role (1)
(ex: formBean.setRole(req.getUserPrinicipal) in "onSave" in action.
Now your can call formBean.validate() in your action.
And... your formBean class must implement a validate method to do all your logic.
This way you can use the same formbean validation in model1, or anywhere where you need the bean.
Or a variant of yours.... is to just do (1) and then do your role thingy. That code could be usefull to others.
,V
PILGRIM, Peter, FM wrote:
Hi
Has anyone used the Struts Validator with security roles?
What I would like to do validate on fields which depend on the login account detail. It doesn't matter what kind of
the credential either user id, realm, or group role but the type will be a java.lang.String. For example
role: `submitter'
check the fields `firstName', `lastName' are not null or blank
role: `reviewer'
check also the fields `firstName', `lastName' are not null or blank but also check `supervisor', `department' too.
My first thought would be to subclass the `FieldChecks' class (1.1 beta3) to add an extra parameter `role', but then how
do I get the "role" into the action form bean.
Thoughts?
--
Peter Pilgrim,
Struts/J2EE Consultant, RBoS FM, Risk IT
Tel: +44 (0)207-375-5642
********************************************************************
Visit our Internet site at http://www.rbsmarkets.com
This e-mail is intended only for the addressee named above.
As this e-mail may contain confidential or privileged information,
if you are not the named addressee, you are not authorised to
retain, read, copy or disseminate this message or any part of it.
The Royal Bank of Scotland plc is registered in Scotland No 90312
Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB
Regulated by the Financial Services Authority
********************************************************************
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>