Ignition Perspective (Security)

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

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).

{
  "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"
    }
  ]
}
4 Likes

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

1 Like