Enforcing User Privileges
- Updated2025-03-28
- 1 minute(s) read
Enforcing User Privileges
Most of the dialog boxes you can launch using methods in the TestStand Engine verify user privileges for you and disable controls the user does not have permission to access. However, most of the TestStand API does not enforce privileges to avoid overly restrictive situations. For example, if the TestStand API strictly enforced the execution privilege, the application could not run the LoginLogout callback sequence to allow a user to log in.
The application developer is responsible for enforcing user privileges. TestStand provides a predefined set of user privileges and an Engine method you can call to verify whether the current user has a specific privilege. To determine whether to disable controls or menu items in the application, call the Engine.CurrentUserHasPrivilege method. Pass the value of one of the UserPrivileges string constants for the privilegeName parameter. If no user is currently logged in, the Engine.CurrentUserHasPrivilege method always returns False. If privilege checking is disabled, the Engine.CurrentUserHasPrivilege method always returns True.