# Configure view permissions through scripting

**URL:** <https://forum.inductiveautomation.com/t/configure-view-permissions-through-scripting/35390>\
**Category:** General Discussion\
**Created:** [June 8, 2020, 4:03am UTC](https://forum.inductiveautomation.com/t/configure-view-permissions-through-scripting/35390 "2020-06-08T04:03:46Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ashwin.m](https://avatars.discourse-cdn.com/v4/letter/a/ea666f/32.png) [@ashwin.m](https://forum.inductiveautomation.com/u/ashwin.m)\
**Post date:** [June 8, 2020, 4:03am UTC](https://forum.inductiveautomation.com/t/configure-view-permissions-through-scripting/35390/1 "2020-06-08T04:03:46Z")

</div>

Hi,  
I was trying to grant user roles to the views through scripting. Is that possible?

 ![userRoles](https://us1.discourse-cdn.com/inductiveautomation/original/2X/a/a9d7083c75ffe7ce71ddd65476edfff26790da30.png)  
I want to achieve this through scripting.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [June 8, 2020, 4:42am UTC](https://forum.inductiveautomation.com/t/configure-view-permissions-through-scripting/35390/2 "2020-06-08T04:42:36Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jacob.ramirez](https://avatars.discourse-cdn.com/v4/letter/j/9dc877/32.png) [@jacob.ramirez](https://forum.inductiveautomation.com/u/jacob.ramirez)\
**Post date:** [February 29, 2024, 9:15pm UTC](https://forum.inductiveautomation.com/t/configure-view-permissions-through-scripting/35390/3 "2024-02-29T21:15:18Z")

</div>

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.

![access_denied](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/f/4f98824624365968e2d5263d8925ecc172a76d0b.png)

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [February 29, 2024, 9:38pm UTC](https://forum.inductiveautomation.com/t/configure-view-permissions-through-scripting/35390/4 "2024-02-29T21:38:01Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jacob.ramirez](https://avatars.discourse-cdn.com/v4/letter/j/9dc877/32.png) [@jacob.ramirez](https://forum.inductiveautomation.com/u/jacob.ramirez)\
**Post date:** [February 29, 2024, 9:55pm UTC](https://forum.inductiveautomation.com/t/configure-view-permissions-through-scripting/35390/5 "2024-02-29T21:55:46Z")

</div>

That's a great idea, I can make that work. Thank you.

---

<div class="post-metadata">

**Author:** ![srinivasan\_s](https://avatars.discourse-cdn.com/v4/letter/s/eb9ed0/32.png) [@srinivasan\_s](https://forum.inductiveautomation.com/u/srinivasan_s)\
**Post date:** [June 20, 2024, 9:53am UTC](https://forum.inductiveautomation.com/t/configure-view-permissions-through-scripting/35390/6 "2024-06-20T09:53:05Z")

</div>

Hey @jacob.ramirez , Can you please explain in detail how you have achieved this?

---

<div class="post-metadata">

**Author:** ![jacob.ramirez](https://avatars.discourse-cdn.com/v4/letter/j/9dc877/32.png) [@jacob.ramirez](https://forum.inductiveautomation.com/u/jacob.ramirez)\
**Post date:** [June 20, 2024, 12:51pm UTC](https://forum.inductiveautomation.com/t/configure-view-permissions-through-scripting/35390/7 "2024-06-20T12:51:25Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![srinivasan\_s](https://avatars.discourse-cdn.com/v4/letter/s/eb9ed0/32.png) [@srinivasan\_s](https://forum.inductiveautomation.com/u/srinivasan_s)\
**Post date:** [June 21, 2024, 4:27am UTC](https://forum.inductiveautomation.com/t/configure-view-permissions-through-scripting/35390/8 "2024-06-21T04:27:05Z")

</div>

Thank you for reply. Will work on it.
