12-08-2007 02:44 PM
From inside LabVIEW Full OI, I want to test if the operator logged in after the IApplicationMgr Start.
Right after the IApplicationMgr ‘Start’ I have a loop that tests the IApplicationMgr ‘LoginLogoutRunning’ state and waits until the LoginLogout call back is done.
I want to exit if the program if operator canceled the login and did not log in.
I have tried “GetEngine” ref. From there get the “CurrentUser” ref but seems not to contain any information about the Current User.
How can I test from my Operator Interface code logged in state of the application?
Thanks
Jim D.
12-10-2007 11:44 AM
Try Engine.CurrentUserHasPrivilege
For the string parameter 'privilegeName' enter Priv_UserLoggedIn or the string value "*".
"Priv_UserLoggedIn–(Value: "*") Use this value with the Engine.CurrentUserHasPrivilege method to determine whether a user is logged in."
Option 2: You could also setup a callback on application manager for UserChanged Event. If the User is null then the login was canceled. (see a copy of the help further down)
From the teststand help for Engine.CurrentUserHasPrivilege method below...
Engine.CurrentUserHasPrivilege ( privilegeName)
True if the current user has the privilege.
Confirms whether the current user or any user group that the user is a member of has a specific privilege.
Returns True when the privilege property is True, when the privilege property of any group that contains the privilege is True, or when privilege checking is disabled, StationOptions.EnableUserPrivilegeChecking is False. If privilege checking is disabled but StationOptions.RequireUserLogin is True, this function returns True only if there is a user currently logged on.
privilegeName As String
[In] Specifies the name of the privilege to check. You can specify the name of any privilege property. You can specify the full privilege path in the user privileges property tree, for example, Debug.RunSelectedSteps, or you can specify the base privilege name, RunSelectedSteps. If you specify only the base privilege name and more than one instance of the base privilege name exists, then the method returns the value of the first base privilege it finds with that name. Refer to UserPrivileges for more information.
Teststand callback for UserChanged Event...
ControlName_UserChanged ( user)
Occurs when the current user logged in changes.
Use this event to update the parts of your user interface that depend on user permissions when the current user logged in changes.
user As User
[In] Current user. If this parameter is NULL, there is no user logged in.