Ignition User log-in from only one client or session

Hi all,

We have an application in a lab environment with different test-benches. Each desktop has an HMI panel. The intention is to have one Administrator user and different student users. The administrator can only login at one test bench at the same time and hereby disables all the write possibilities at the other test benches.

As I’m new to Ignition, I wanted to ask if this is possible in Ignition. What is best suited for this, vision of perspective? Other than HMI Panels at the testbenches, wa want professeros to walk around with theri tablets to view and control the installation, so for that we want to use perspective.

Thanks,
Simon

You could do this in the client startup script using the Node tag and system.util.getSessionInfo()

system.tag.read('[System]Client/Network/Hostname').value

To get the Computer name

ret = system.util.getSessionInfo()
for r in ret:
	print r[0]

to get the list of logged in users.

Thanks for the answer.

I tried this script both in the client startup (vision) and the session startup (perspective). Only in client startup it works. Can I do something similar in session startup of perspective sessions?

We don’t use perspective so someone else will have to answer that.
@Kevin.Herron

As of v8.0.7, there’s a separate system.perspective.getSessionInfo() specifically for Perspective client information.

I don’t use Perspective either :rofl:

Gotta get @PGriffith or @cmallonee in here for some Perspective skillz.

2 Likes

Sure this could be done in Perspective, but it’s a little more difficult than you would think. There’s no limitation that could be put in place on a project to limit the number of sessions a user could have open, so we’ll need to get creative in managing the “Administrator” user.

It sounds like you only want the Administrator to be logged in at a single test bench at a given time. It’s not clear if they should also remain logged into their own tablet while logging into and out of the test benches, which could add another wrinkle to all of this. If you want them to remain logged into their tablet, you could consider a separate project to be used on the tablet, or you could also check to see if they’re on a mobile device (which is actually checking to see of they’re using the Perspective Application, as opposed to using a browser on a mobile device) and if so prevent the logout invocation.

Basic suggested structure:
You will need to provide a component somewhere within the project (most likely a button) that the Administrator will need to click to sign in. This button should use a script to send a message to the Gateway with the intent of triggering a logout for any session in which that user is logged in. The script should then logout the current user (in case a student is signed in). Finally, the script should request the current user sign in.

# 'S' scope sends this directly to Perspective Sessions, and 'user' limits those Sessions to only those where the specified user is logged in.
system.util.sendMessage(project='MyProject', messageHandler='LOGOUTADMIN', payload={}, scope='S', user='Administrator')
system.perspective.logout()  # important in case the current user is not the Administrator
system.perspective.login(). # now the Administrator may log in.

You will also need to configure a “Message” Session Event (ignore the SESSIONBROADCAST Message - this was done in a working project with other Handlers already in place):

Please note that this solution has some hard-coded values. If you have multiple “Administrator” users, you would need to loop over a list, or send the list as part of the payload and then loop through the list in the Message Handler.

2 Likes