So, My problem was to have parts of the HMI program to be locked out. Since I had the ability to know which client was online, I needed to lock and unlock screens. Arguing with my customer was not a solution.
In the end I made a Giant momentary button for my screens that hid the items I wanted to disable. The background color of this button made the button “see through”
On the clients I made 2 tags,
One tag was an if statement of client OSUsernames and gave me a value for each station.
The other tag was a get.Roles to bypass the tag with security if needed.
Next I tied the tag to my giant momentary button’s visibility. I am surprised it worked, and that the components changed on each client (client scope).
When the invisible color button is “visible” it stops all events behind it. When the invisible color button is “not visible” it allows the users to push all of the buttons behind it.
This may help users but here is my expression code on the thin client tag.
if({[System]Client/User/OSUsername}="jadair",0,
if({[System]Client/User/OSUsername}="thinclient2",2,
if({[System]Client/User/OSUsername}="thinclient3",3,
if({[System]Client/User/OSUsername}="thinclient4",4,
if({[System]Client/User/OSUsername}="thinclient5",5,
if({[System]Client/User/OSUsername}="thinclient6",6,
if({[System]Client/User/OSUsername}="thinclient7",7,
if({[System]Client/User/OSUsername}="thinclient8",8,
if({[System]Client/User/OSUsername}="thinclient9",9,
0)))))))))
Here is my code for scripting the security based bypass bit
Roles=system.security.getRoles()
Name=system.security.getUsername()
event.source.parent.parent.getComponent('AccessLevel').getComponent('AccessLabel').text ='User Name: '+ Name
if "Administrator" in Roles:
event.source.text = 'Access: Admin'
system.tag.write("[client]CurrentHMIInUse/BypassDisableScreens",1)
elif "Supervisor" in Roles:
event.source.text = 'Access: Supervisor'
system.tag.write("[client]CurrentHMIInUse/BypassDisableScreens",1)
elif "Engineer" in Roles:
event.source.text = 'Access: Engineer'
system.tag.write("[client]CurrentHMIInUse/BypassDisableScreens",1)
elif "Maintenance" in Roles:
event.source.text = 'Access: Maintenance'
system.tag.write("[client]CurrentHMIInUse/BypassDisableScreens",1)
elif "Operator" in Roles:
event.source.text = 'Access: Operator'
system.tag.write("[client]CurrentHMIInUse/BypassDisableScreens",0)
else:
system.tag.write("[client]CurrentHMIInUse/BypassDisableScreens",0)
And here is the code I threw on the button visibility.
//Client tag found in client folder it changes based on what is logged in.
//Station number allowed is the custom property on this template to set the button with.
if({[client]CurrentHMIInUse/ClientNumber}={DisableBox.StationNumberToAllow},0,
if({[client]CurrentHMIInUse/BypassDisableScreens},0,1))
And on the end note… “single point of failure” = Ignition server. The application VM and Ignition VM run on the same blade server.