Hi guys, have a good days.
Currently, I would like to hide one of the objects(button) based on the user roles. For instances, only Administrators are able to see the button but the other users that login with different roles are not able to see it.
In conclusion, may I know that is that any way to hide an objects which is a button in the Ignition based on the user roles.
If YES, do I need to write the script or Ignition already have the function to work it ?
Thanks
Couple ways to do this. You can utilize the hasRole()
expression in a binding on the visiblity property. So the visibility property would look like
hasRole('Administrator')
.
You can also use the build in component security for this. Right click a component and select security (or use cntrl+e when the component is selected) and you will see Security Settings appear like this -
If the container your component is in does not have the security settings you desire, uncheck “Inherit Permissions”, check off “Hide” since that is the default behavior you want the component to do, and the select “Administrator” under the exempt roles - they will be exempt from the component hiding.
As for which of these ways is preferable or better, I will leave that to someone else who more regularly uses security to answer.
i tried to use your code but doesnt works
What is the Error_Configuration
message? (Hover over it.)
You're in Perspective. @bkarabinchak.psi's answer was for Vision.