Security button

The idea for this post is to implement a button that will request a pop up login for authorisation. For instance, say there is a Fault Reset Button that will reset any error on a system. The idea is to request a login password that only an authorised/competent person will only be allowed to press it after the error investigation has been completed. Any ideas? Thank you in advance.

P.S Does this require scripting? Is it possible to implement this in Perspective?

Yes you can do this in perspective, yes it will need scripting. Here is a link to Ignition 8 scripting functions
and here is a link to system.perspective.isAuthorized.
a generic example would be like so

path1 = "Authenticated/Roles/Administrator"
isAuthorized = system.perspective.isAuthorized(False, path1)
if isAuthorized:
     run your script

Thanks for the help. Do I right click on my button and paste this on "Add HAndler" on configure script?

right click on button → configure events → onActionPerformed → click plus button → script → write script

I do not have the Component Events Options. Any ideas?

try selecting the component and using ctrl+j

Doesn’t seem to be doing anything. I appreciate your help though.

if haven’t already, check out www.inductiveuniversity.com It has lots of free videos that will help you learn fast.

What version of Ignition are you using? The onActionPerformed Component Event was introduced in Ignition 8.0.2. If you’re not seeing it, then it’s probably because you’re on an older version.

If you don’t want to upgrade, you could instead use the onClick event instead. Really, you just need an event that reliably triggers when the user taps/presses the button.

Also, if you’re having your users actually login, you could use the login Action instead of writing a script.

I did try that but it just gave me an error that doesnt explain much.

That’s unfortunate. If you post the error here we could offer some better advice.

image

Thanks for that I am on V8.0.0 currently indeed.

The login action is trying to redirect the user to your Identity Provider’s login, and failing to do so because your project isn’t configured to use an Identity Provider.
As represented at the 00:50 mark here: https://www.inductiveuniversity.com/videos/requiring-authentication/8.0

You need to set an Identity Provider for the login action to work. However, after rereading the thread, I’m uncertain what exactly you are trying to do.

Which of the following are you trying to do

  1. Apply actual authentication, as in have the user log in as an authorized account

…or…

  1. Call a popup that lets users type in some password/secret string, and then validate what was typed, all without changing the authenticated user.

Of the above two options, 1 is a bit simpler, but does require you to create and manage your users in an Identity Provider (which could simply be Ignition’s Identity Provider). Option 2 requires a bit of extra work and scripting, but is very possible. Personally, I’d suggest option 1.

Very helpful indeed. The aim is to follow No2 if I’m honest but I am not familiar with scripting at all.Ill update to version 8.0.4 and see how that goes. Cheers