Auto Logout (Switch Users)

I would like to auto-logout after a certain amount of time, but instead of logging out of the client application, I just want to switch to a default user that has less roles for security. This should be per client.

You could run a client timer script that checks system.util.getInactivitySeconds periodically, and conditionally calls system.security.switchUser.

1 Like

Isn’t that a waste of processing power, to run a script that every couple of seconds to check a tag value. or am I overthinking how much power that would actually take.

Vastly overestimating how much it would take to run. It’s not even a tag access - it’s literally just grabbing a value from memory. I can pretty much guarantee that the timer script would complete in milliseconds in the no-op case.

1 Like

Alright I’ll do it like that then. Thanks for the help.

Alright, after adding this, it runs every second, now all of my templates on a screen blink every seconds, it is directly correlated to that script running

Only have switch user execute if it needs to do. Check if the specific user is logged in, if they are, don’t execute.
https://docs.inductiveautomation.com/display/DOC80/system.security.getUsername

3 Likes

Duh, that makes a lot of sense, otherwise it is just constantly logging out, lol. Thanks for the help