# isAuthorized for the entire View

**URL:** <https://forum.inductiveautomation.com/t/isauthorized-for-the-entire-view/104797>\
**Category:** Ignition\
**Tags:** perspective, scripting\
**Created:** [April 7, 2025, 7:22pm UTC](https://forum.inductiveautomation.com/t/isauthorized-for-the-entire-view/104797 "2025-04-07T19:22:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![subray.shirodkar](https://avatars.discourse-cdn.com/v4/letter/s/e19adc/32.png) [@subray.shirodkar](https://forum.inductiveautomation.com/u/subray.shirodkar)\
**Post date:** [April 7, 2025, 7:22pm UTC](https://forum.inductiveautomation.com/t/isauthorized-for-the-entire-view/104797/1 "2025-04-07T19:22:06Z")

</div>

I have a button named "SET" on my view which I want to enable when an authorized person ("Administrator") is signed in on the session.  
I have made a sign-in and sign-out button which can be used for authentication or to sign in in to the session, so when Admin is signed in, the SET button should be enabled and when signed out it should be disabled/grayed out.

For this I used 'isAuthorized' for the entire view rather than on the SET button, but for some reason it is not working properly. Could you be able to help me figure out with this....

This is the Configure Event script for the entire view

def runAction(self):  
isAuthorized = system.perspective.isAuthorized(False, 'Authenticated/Roles/Administrator')  
if (isAuthorized == False):  
self.getChild("root").getChild("Button").props.enabled = isAuthorized

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/e/4efb12007bca81b2daadef97800eeae50e2c300d.png)

Thank you in advance!!

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [April 7, 2025, 7:28pm UTC](https://forum.inductiveautomation.com/t/isauthorized-for-the-entire-view/104797/2 "2025-04-07T19:28:12Z")

</div>

There is no such thing as `system.perspective.isAuthorized()`. `isAuthorized()` is an **expression** function, not a scripting function.

Don't use a script. Just use an expression binding on the button's `props.enabled` property.

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [April 7, 2025, 8:10pm UTC](https://forum.inductiveautomation.com/t/isauthorized-for-the-entire-view/104797/3 "2025-04-07T20:10:03Z")

</div>

> **[isAuthorized | Ignition User Manual](https://www.docs.inductiveautomation.com/docs/8.1/appendix/expression-functions/users/isAuthorized)**
>
> Returns a qualified value with a boolean value which is true if the user in the current Session is authorized, false otherwise.

Please see [Wiki - how to post code on this forum](https://forum.inductiveautomation.com/t/wiki-how-to-post-code-on-this-forum/77831).

---

<div class="post-metadata">

**Author:** ![subray.shirodkar](https://avatars.discourse-cdn.com/v4/letter/s/e19adc/32.png) [@subray.shirodkar](https://forum.inductiveautomation.com/u/subray.shirodkar)\
**Post date:** [April 10, 2025, 12:49pm UTC](https://forum.inductiveautomation.com/t/isauthorized-for-the-entire-view/104797/4 "2025-04-10T12:49:21Z")

</div>

Thank you for the info. Yes, I used the expression binding which worked correctly.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [April 10, 2025, 1:08pm UTC](https://forum.inductiveautomation.com/t/isauthorized-for-the-entire-view/104797/5 "2025-04-10T13:08:29Z")

</div>

If your button is writing to a tag, then I would recommend that you put the write permissions on the tag instead to centralise your security config. You can either leave the button as is and attempting to push it will result in a warning that the tag couldn't be written to (won't do this natively if you're writing it via script), or you can bind the button's enabled prop to the write tag's `canWrite` prop eg "tag/path.canWrite"
