Hide buttons based on user role

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

Hide buttons based on user role

spanithi
Hi ,

I created a form and inside my form I have few buttons couple of them are approve and reject.
I want to show these two buttons only for admin role users. I created two users with two different roles like shf-admin and shf-owner in tomcat-users.xml .
I tried doing this with 
oxf.fr.detail.button.BUTTON.visible.*.* , I am able to hide the button but I am not user how this can be achieved on user role basis.

Your help or inputs would be really great and helpful.

Thank you in advance,
Satish

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Reply | Threaded
Open this post in threaded view
|

Re: Hide buttons based on user role

Alessandro  Vernet
Administrator
Hi Satish,

In the XPath expression, to only show a given button if the user is an
admin, you should just be able to use something along these lines:

  xxf:user-roles() = 'shf-admin'

For this to work, you'll also need to set the
`oxf.fr.authentication.container.roles` property to list all the possible
roles you have, or at least those you are interested in. You'll let us know
if this works for you.

https://doc.orbeon.com/xforms/xpath/extension-http.html
https://doc.orbeon.com/form-runner/access-control/users.html

Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Hide buttons based on user role

spanithi
In reply to this post by spanithi
Hello Alex,

Thanks for your prompt reply.
Could you also please let me know where I need to put this code lines(  xxf:user-roles() = 'shf-admin') in .

I mean do i need to add in the form source or property? pls let me know.

Regards,
Satish

On Tuesday, November 28, 2017 at 11:17:57 PM UTC+5:30, Satish Panithi wrote:
Hi ,

I created a form and inside my form I have few buttons couple of them are approve and reject.
I want to show these two buttons only for admin role users. I created two users with two different roles like shf-admin and shf-owner in tomcat-users.xml .
I tried doing this with 
oxf.fr.detail.button.BUTTON.visible.*.* , I am able to hide the button but I am not user how this can be achieved on user role basis.

Your help or inputs would be really great and helpful.

Thank you in advance,
Satish

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Reply | Threaded
Open this post in threaded view
|

Re: Hide buttons based on user role

spanithi
In reply to this post by spanithi
Hello Alex,

Thanks for your prompt reply.
Could you also please let me know where I need to put this code lines(  xxf:user-roles() = 'shf-admin') in as its an custom button added in properties

https://doc.orbeon.com/form-runner/advanced/buttons-and-processes/

I mean do i need to add in the form source or property? pls let me know.

Regards,
Satish

On Tuesday, November 28, 2017 at 11:17:57 PM UTC+5:30, Satish Panithi wrote:
Hi ,

I created a form and inside my form I have few buttons couple of them are approve and reject.
I want to show these two buttons only for admin role users. I created two users with two different roles like shf-admin and shf-owner in tomcat-users.xml .
I tried doing this with 
oxf.fr.detail.button.BUTTON.visible.*.* , I am able to hide the button but I am not user how this can be achieved on user role basis.

Your help or inputs would be really great and helpful.

Thank you in advance,
Satish

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Reply | Threaded
Open this post in threaded view
|

Re: Hide buttons based on user role

Alessandro  Vernet
Administrator
Satish, in this case, you would call the `xxf:user-roles()` XPath function as
part of the XPath expression you put in the
`oxf.fr.detail.button.BUTTON.visible.*.*` property you mentioned earlier. Or
am I missing what you're asking about?

https://doc.orbeon.com/configuration/properties/form-runner-detail-page.html

Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Hide buttons based on user role

spanithi
In reply to this post by spanithi
Alex. I was able to do this with the following property

<property as="xs:string"  name="oxf.fr.detail.button.approve.visible.*.*">
     xxf:user-roles() = 'shf-admin'
</property>

Thanks much for your inputs.

Satish

On Tuesday, November 28, 2017 at 11:17:57 PM UTC+5:30, Satish Panithi wrote:
Hi ,

I created a form and inside my form I have few buttons couple of them are approve and reject.
I want to show these two buttons only for admin role users. I created two users with two different roles like shf-admin and shf-owner in tomcat-users.xml .
I tried doing this with 
oxf.fr.detail.button.BUTTON.visible.*.* , I am able to hide the button but I am not user how this can be achieved on user role basis.

Your help or inputs would be really great and helpful.

Thank you in advance,
Satish

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Reply | Threaded
Open this post in threaded view
|

Re: Hide buttons based on user role

Alessandro  Vernet
Administrator
Excellent Satish; I'm glad that worked!

Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet