Create a TestStand Custom Step for That Only Specific Users Can Place

Updated Oct 31, 2023

Environment

Software

  • TestStand

When architecting systems in NI TestStand, there might be a need for certain custom steps to only be accessible by users with specific privileges. Within NI TestStand's highly customizable platform there is a feature that can be used to enable this user control. This feature is the OnNewStep and step.CancelCurrentExecution which is part of the Custom Step built-in features.

This guide will walk you through the different steps required to create the custom privilege and to create the custom step type that will use LabVIEW to enable/disable access to placing that step.

This guide uses NI TestStand 2019 32bit and LabVIEW 2019 32bit.

Creating the Custom Privilege

This will create the privilege in NI TestStand that will be used to decide if access is correct, and enable the user to successfully place the custom step.
  1. In the Types window, go the User Manager 
  2. Within the Standard Data Types menu, expand the “NI_UserCustomPrivileges”
  3. Create a Boolean Privilege labelled as you would like to be known:
    • Right-click on <Right click to insert Field>
    • Choose Insert Field
    • Choose Boolean
    • Set the desired name

Create the Required LabVIEW VI

This VI will be used in the next section and will execute the command to cancel the execution of placing a step dependant on whether or not the user has the correct privileges. Below is an image of the code that will need to be created. It uses the current Sequence Context to access the reference to the engine and the step by using Property Nodes.

The Engine uses an Invoke Node to access the method "CurrentUserHasPrivilege" which will access the users TestStand profile and check it against the named privilege. If they do not have access then it will set the Step property "CancelCurrentExecution" to be True. The step execution here is referencing to the process of placing a step. 

The only terminal of the connector pane that is required, is the Sequence Context In. Error terminals could also be added.



Create the Custom Step Type

  1. Under MyTypes.ini create a new step
  2. Within SubSteps add a Custom step called: OnNewStep
  3. With that step selected, press Specify Module...
  4. At (1), Select the VI created in an earlier step
    1. The only required change is the Privilege name to check against the user.
  5. At (2), Edit the VI call to include the Sequence Context In by passing the parameter "ThisContext" in.
  6. Save and test with users with differing privileges.