# Ignition Perspective (Security)

**URL:** <https://forum.inductiveautomation.com/t/ignition-perspective-security/32895>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [March 6, 2020, 5:36pm UTC](https://forum.inductiveautomation.com/t/ignition-perspective-security/32895 "2020-03-06T17:36:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jaspinall](https://avatars.discourse-cdn.com/v4/letter/j/a587f6/32.png) [@jaspinall](https://forum.inductiveautomation.com/u/jaspinall)\
**Post date:** [March 6, 2020, 5:36pm UTC](https://forum.inductiveautomation.com/t/ignition-perspective-security/32895/1 "2020-03-06T17:36:35Z")

</div>

Hi All,

I am just curious how you can tie Security to a specific component in Perspective which does not have an event script setup. The “Add Security” functionality works great for our buttons as they have scripts tied to them… but how would we add security to something like the “Numeric Entry” component?

Thank You

---

<div class="post-metadata">

**Author:** ![kirsten.chambers](https://avatars.discourse-cdn.com/v4/letter/k/48db29/32.png) [@kirsten.chambers](https://forum.inductiveautomation.com/u/kirsten.chambers)\
**Post date:** [March 6, 2020, 5:54pm UTC](https://forum.inductiveautomation.com/t/ignition-perspective-security/32895/2 "2020-03-06T17:54:02Z")

</div>

Thus far, the primary means of securing components in Perspective is through session properties. Under `auth` there are the `securityLevels` and `user.roles` properties, which give you insight into the user’s privileges (provided you’re using roles/security zones and are requiring the user to log in, otherwise these properties are null-valued).

You can then set bindings as needed on components you wish to lock down. For example, to secure a Numeric Entry component, you could place a binding on it’s `props.enabled` property to disable it if the user doesn’t have a certain role/zone. Alternatively, if you don’t even want unauthorized users to see a component, you can set its `meta.visible` property to false with the same logic.

Here’s an example of a binding that you can Copy and Right-Click+“Paste Binding” onto the `enabled` property of, say, a Numeric Entry Field in your designer. Note that designer sessions have null-valued `auth` properties, so I alternatively allow designers access to the Numeric Entry box for debugging purposes (which you may or may not find useful).

```auto
{
  "type": "property",
  "config": {
    "path": "session.props.auth.user.roles"
  },
  "transforms": [
    {
      "code": "\t# str() cast here so there\u0027s no freak-out over \u0027null\u0027 auth.user.roles prop in designer\n\tif \"Administrator\" in str(value) or self.session.props.device.type \u003d\u003d \"designer\":\n\t\treturn True\n\telse:\n\t\treturn False",
      "type": "script"
    }
  ]
}
```

---

<div class="post-metadata">

**Author:** ![jaspinall](https://avatars.discourse-cdn.com/v4/letter/j/a587f6/32.png) [@jaspinall](https://forum.inductiveautomation.com/u/jaspinall)\
**Post date:** [March 6, 2020, 6:06pm UTC](https://forum.inductiveautomation.com/t/ignition-perspective-security/32895/3 "2020-03-06T18:06:47Z")

</div>

Thanks @kirsten.chambers - that is exactly what we were looking for.
