Security Question

Hello,
I am using the auto login function with a standard view only user profile. Basically what I am trying to to is allow anyone to view the project but only allow authorized users to make changes. the idea is if the user wants to push buttons or enter information into a text field, the user has to log in to do so. After a certain amount of time (15 min), the user is logged out, and the view only profile is logged back in. I have a logout button and it works well enough, i am thinking of using a client event script for the 15 min. user login. My confusion is whether to use the timer script ( makes sense ) or a tag change script. I pretty sure that i want to point the script to the client.system.user tag to accomplish this. Any suggestions would be helpful. I am still exploring this on my own.

For this you want to use a Client Event Timer Script under Project -> Client Event Scripts. You can run the timer script every minute or so checking for the number of seconds since any keyboard or mouse activity happens. Your function will look like this:

seconds = system.util.getInactivitySeconds() if seconds == 900: # 15 minutes system.security.switchUser('guest', 'guest')
Hope this helps.

Travis,
Yes that’s about what I was thinking although I was a little confused on which route to take.
I will try this out. Thanks!

Travis,
I tried the script and it doesn’t seem to be working. I put it in the client event scripts under the configuration section in the Designer. I set the delay to 120,000 ms the delay type to fixed rate and the thread option s to run in shared. I then entered the script in as follows:
seconds = system.util.getInactivitySeconds()
if seconds == 120:
system.security.switchUser(‘view only’, ‘password’)

I set the time to 120 seconds so I didn’t have to wait every 15 min to see if it works. I also tested by adding a button and entering the last script line in the event handler. it works when I push the button. What am I doing wrong?

You have to test it out in the client by leaving the client alone for two minutes. You can add a print statement in the script to see if it is runnning:print "here"That print out will show in the console under Help->Diagnostics in the client.

It’s working now, had a couple spaces instead of using a tab.
thanks again guys.

May I suggest changing the “==” to a “>=”? If it misses that execution at 900 seconds, it may never log out.

if seconds == 900:

to something like

if user != “guest” and seconds >= 900:

Note: you’d have to get the variable user. (Which is easy to do, but I don’t remember how to off the top of my head)

Cheers

Kevin - excellent points.