Security button

#1

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?

0 Likes

#2

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
0 Likes

#3

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

0 Likes

#4

right click on button -> configure events -> onActionPerformed -> click plus button -> script -> write script

0 Likes

#5

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

0 Likes

#6

try selecting the component and using ctrl+j

0 Likes

#7

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

0 Likes

#8

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

0 Likes

#9

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.

0 Likes

#10

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

0 Likes

#11

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

0 Likes

#12

image

0 Likes

#13

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

0 Likes

#14

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.

0 Likes

#15

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

0 Likes