System.security.logout inquiry

Hello,

 I am relatively new to working with Ignition. I have implemented an automatic logout feature using system.security.logout(), but would like to exclude a certain role from being logged out. I have seen some other threads on this, but I am not sure they will work the same as our client is using Active Directory. Can someone please advise on the simplest and best way to accomplish this? Thanks!

Hi, Keith. Welcome to the forums!

There are a couple of different ways to get a list of a user’s role.

One uses the RolesString tag.

roles = system.tag.read('[System]Client/User/RolesString').value.split(',') if "lookupRole" in roles and system.util.getInactivitySeconds() > 600: #Check for 10min. inactivity system.security.logout()

Another uses a couple of different scripting functions:

roles = system.user.getUser("",system.security.getUsername()).getRoles() if "lookupRole" in roles and system.util.getInactivitySeconds() > 600: #Check for 10min. inactivity system.security.logout()

Either way will get you there. It’s really just a matter of preference. Or what makes more sense to you. :slight_smile:

Thank you Jordan.