Applying default constraint on form based on role

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Applying default constraint on form based on role

Kamlesh
Hi,

I have enabled TOMCAT JDBC Realm in Orbeon. On the form I have applied made
some of the controls visible and read-only based on logged-in user name and
role. I have a respecific requirement that I want to override all the
validations (read-only and visiblity) for a specific role and made all the
controls enabled by default for him.

* I am using Orbeon Form Builder for designing the forms.

Any suggestion will be appreciated.

- Kamlesh


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Applying default constraint on form based on role

Alessandro Vernet
Administrator
Kamlesh,

Kamlesh123 wrote
I have enabled TOMCAT JDBC Realm in Orbeon. On the form I have applied made
some of the controls visible and read-only based on logged-in user name and
role. I have a respecific requirement that I want to override all the
validations (read-only and visiblity) for a specific role and made all the
controls enabled by default for him.
If the user is logged in, and you have assigned a role to that user, you can test on that role in XPath with xxforms:is-user-in-role('your-role'). If you want to hide a control unless the user has the role "manager", you will put in the "relevance" XPath: xxforms:is-user-in-role('manager'). I hope this helps,

Alex
Reply | Threaded
Open this post in threaded view
|

Re: Applying default constraint on form based on role

Alessandro Vernet
Administrator
Alessandro Vernet wrote
If the user is logged in, and you have assigned a role to that user, you can test on that role in XPath with xxforms:is-user-in-role('your-role'). If you want to hide a control unless the user has the role "manager", you will put in the "relevance" XPath: xxforms:is-user-in-role('manager'). I hope this helps,
You can also find more about this on:

http://www.orbeon.com/ops/doc/reference-xforms-functions

Alex
Reply | Threaded
Open this post in threaded view
|

Re: Re: Applying default constraint on form based on role

Kamlesh

Hi Alex,

My apologies if i could not make myself clear,
I have already applied these functions to the controls of the form. My
requirement is to figure out a way to override these applied conditions for a
particular role, say, default role, and to provide all the controls their
default behaviour for this particular role.

Is there a way to do this?

- Kamlesh


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Applying default constraint on form based on role

Alessandro Vernet
Administrator
Kamlesh,

Kamlesh123 wrote
My apologies if i could not make myself clear,
I have already applied these functions to the controls of the form. My
requirement is to figure out a way to override these applied conditions for a
particular role, say, default role, and to provide all the controls their
default behaviour for this particular role.
I see. So assuming you have the following binds:

<xforms:bind nodeset="raise" relevant="false()"/>
<xforms:bind nodeset="salary" readonly="true()"/>

If you don't want those to apply if the current user has the "manager" role, you can write:

<xforms:bind nodeset=".[not(xxforms:is-user-in-role('manager'))]">
    <xforms:bind nodeset="raise" relevant="false()"/>
    <xforms:bind nodeset="salary" readonly="true()"/>
</xforms:bind>

Alex