Two part question
- I am trying to setup so if an Admin Account is inactive for set time they are logged out and an Operator Account is logged in.
- How can we show the current user logged in?
Thanks
Two part question
Thanks
In Vision, this sort of information is available in the [System]
tag provider. Combine that with a client timer event that monitors the inactivity time.
Hi Larry,
You have the Inactivity timeout properties in the Project properties in the designer.
For vision it's in Project Properties > Vision > Timing
For perspective it's in Project Properties > Perspective > Inactivity
To show the current user logged in:
Regards,
Jordan,
I'm assuming you replace (username, password) with actual user and password? I've tried this several times with no luck. Thanks.
That is correct.
Did you try this in a running client? It won't work in the designer.
Yessir. I set the script up in Client Event Scripts-Timers, Apply/OK and save. Run the Client and no luck. I have even tried shutting the client down and restarting to see if it needed that for the script to run. I appreciate the help.
Can you show your work, as my teachers would say?
Sure can. I have tried with and without the getUsername
if system.util.getInactivitySeconds() > 30 and system.security.getUsername() != Admin:
system.security.switchUser(Operator, operator)
The username and passwords need to be in quotes.
Also, when posting code, plese pate it, highlight it, then use the </>
button to format it. I can't tell if there is an indent on the second line or not.
Can you edit your post so the code is in the preformatted style?
Like this:
Just to be sure, on this part
And this part:
Admin and Operator,operator are string variables that were defined earlier and you didn't show it in the snippet of code, right?
Otherwise i don't see anything obviously wrong
You also need to check that the user is not already Operator
, or the timer will try to switch user over and over and over.
That was the ticket. Thanks again.
Hey,
Hope you all are fine, i am stuck in a problem.
I want to show the current user who is login in a label which is in nav bar so can anyone help me how to do it
If you are using perspective, session.props.auth.user
will contain the current user's username and other information. If you are in vision, the [system]Client/User
folder in the tag browser should contain username, roles and other information you can use.
Bind the label's text value to either the session.props.auth.user.username
property if you are in perspective or to the [system]Client/User/Username
tag if you are in vision.