Trying to accomplish two things.
-
Buttons only enabled on the gateway and not on any remote clients. Is there any particular value that I could look at to accomplish this?
-
Enabling/Disabling objects based on role of user logged in. Also have the ability to switch user after inactive time.
Basically needing two roles, control and view only. Gateway has option for both. Client only has option to view. Gateway also needs to automatically switch to view only after an inactive time.
- I would make a script to see if the client IP address and the gateway address is the same.
Then have the script called from the enable / visibilty
Code on the button visible or enable:
runScript("app.Test.remote('{[System]Client/Network/IPAddress}')")
def remote(clientip):
import system
import re
#Get the gateway IP addres
gateip = system.util.getGatewayAddress()
#Format the address to perform the check.
x = gateip.split("/")
y = x[2].split(":")
gatewayip = y[0]
if gatewayip != clientip:
remote = 0
else:
remote = 1
#Return the result
return remote
- Add a Client Event Script under Timer.
Call it Inactivity
if "control" in system.security.getRoles():
if system.util.getInactivitySeconds() > 3000:
uname = "guest"
pwd = "guest"
system.security.switchUser(uname,pwd)
system.nav.goHome()
You could use system.security.logout() also.
But then they can not view the project.
Cheers,
Chris
Simple, yet very effective.