RE: Struts Validator and security roles
-Original Message- From: V. Cekvenich [mailto:[EMAIL PROTECTED]] Hello Vick? Another aproach: Call a setter for the role (1) (ex: formBean.setRole(req.getUserPrinicipal) in onSave in action. Actually I am not going to use the `HttpServletRequest.getUserPrincipal()' or `getRemoteUser', but my own attribute. Now your can call formBean.validate() in your action. I know that you can already validate in the action form And... your formBean class must implement a validate method to do all your logic. This is quite clear. 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 Hmm I cannot grok from what you said if you can use the Struts validator to perform the attribute validation per credential. It seems that the Struts validator can do simple validation from an XML configuration file, but it would need modification to allow this. My guess would be to modify the XML grammar to allow a depend on role also. An attribute of the field tag like this: field property=title depends=required credentials=admin,management ^^ arg0 key=article.title.displayname / /field Thoughts? 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-4923 *** 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]
Struts Validator and security roles
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]
Re: Struts Validator and security roles
Another aproach: 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]