Hi,
I was trying to grant user roles to the views through scripting. Is that possible?
I want to achieve this through scripting.
Hi,
I was trying to grant user roles to the views through scripting. Is that possible?
There is no way to configure View permissions through Scripting, because View permissions are not something that should change at runtime. If you need to change who can have access to a View, you should change that user’s permissions. Also, while you can perform logical checks against a user’s roles in Perspective, the screen you’re looking at is actually Security Levels. Security Levels are used very similarly to roles (which most Ignition users are familiar with), but they aren’t exactly the same.
Is there a way to navigate to that access denied screen? I want to do this via a script that is configured on every screen, instead of going to each screen (100+) and going through that configure view permissions menu.
You could pretty easily set up a new Page Configuration, attach a View to that config, and apply unobtainable permissions to the View. Then place logic somewhere in either session props or on a change script which looks at a user's Security Levels and if they don't meet some requirements navigate them to this page. There's nothing to stop them from trying again, so you'd need to determine the best place/time to navigate them to this restricted Page.
That's a great idea, I can make that work. Thank you.
Hey @jacob.ramirez , Can you please explain in detail how you have achieved this?
When a page loads, I check who the user is and their roles. If their roles don't match the allowed roles for the screen they're trying to access, then call system.perspective.navigate to the newly created page that has permissions set on it that no one has, and then that Access Denied screen will appear.
Thank you for reply. Will work on it.