Securing Event Handlers

You can set up security in an event script using the system.security.getRoles function, and use the function in any script in Ignition that runs in a Client.

To ensure the person invoking the script has sufficient privilages, use the following code:

if u'Administrator'in system.security.getRoles():
#This part of the script will run if the user has the correct priviliges. For example:"
print "this script will run if the user has a the administrator role."
else:
system.gui.errorBox('Insufficient security privileges.')

If the person does not have sufficient privilages, the script will show an error box. The script can be embeded into any event handler.