NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I test the log in state from in side the Operator Interface code.

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.

0 Kudos
Message 1 of 2
(3,164 Views)

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...


CurrentUserHasPrivilege Method

Syntax

Engine.CurrentUserHasPrivilege ( privilegeName)

Return Value

Boolean

True if the current user has the privilege.

Purpose

Confirms whether the current user or any user group that the user is a member of has a specific privilege.

Remarks

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.

Parameters

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...


UserChanged Event

Syntax

ControlName_UserChanged ( user)

Applies To

ApplicationMgr

Purpose

Occurs when the current user logged in changes.

Remarks

Use this event to update the parts of your user interface that depend on user permissions when the current user logged in changes.

Parameters

user As User

[In] Current user. If this parameter is NULL, there is no user logged in.

0 Kudos
Message 2 of 2
(3,143 Views)