I have had an odd request from a customer to not allow changes to an individual’s configuration while they are logged in on any client. Not sure of the context at this stage as it’s 2nd-hand info.
However, is it possible to check if a user is logged into any client?
checkUser = 'jordancclark'
# Get Users that are logged in. Using a set will give unique usernames.
userSet = set([row['username'] for row in system.util.getSessionInfo() if not row['isDesigner']])
userLoggedIn = checkUser in userSet
You can shorten it to this if you are only checking for one user. So a couple of different options.
userLoggedIn = len(system.util.getSessionInfo(checkUser))>0
EDIT: Note that this will not filter out designer sessions.
Awesome, thanks for the help