NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

disable User Group Privledge Selection in TS 3.5 Dialogs

I want to determine the current user priviledge and prevent the assignment of Administrator Group priviledges associated with the New User and User Properties Dialog.
Is there a programatic way to disable the selection of (or remove) a User Group (such as Administrator) from the NewUserDialog (Engine.DisplayNewUserDialog) and the User Properties Dialog (edit user)?
 
 
0 Kudos
Message 1 of 5
(3,556 Views)
Hey goldee,

In order to accomplish this, you'll need to manipulate the TestStand UserGroupList - that's the list of User Groups (i.e. the default Operator, Technician, Developer, Administrator) that is used to populate the dropdown that you're referring to in the Engine.DisplayNewUserDialog.  In order to manipulate the UserGroupList, first obtain a reference to the UsersFile and use that reference to obtain a reference to the UserGroupList.  From here, you can use the methods of the PropertyObject class in order to manipulate (add or remove) UserGroups from the array.

I've attached an example of this process in which I retrieve the first UserGroup (for me this is Operator), remove it from the list, and then re-add it.  This should get you started.

Furthermore, the UsersFile portion of the NI TestStand Help is a great launching point.

I hope this helps!
Derrick S.
Product Manager
NI DIAdem
National Instruments
0 Kudos
Message 2 of 5
(3,529 Views)

I tried your example, but I continue to receive the following error:

Code -17331,An error occurred calling 'DeleteElements' in 'PropertyObject' of 'NI TestStand API 3.5'  Item is locked, protected, or in use and cannot be deleted.

0 Kudos
Message 3 of 5
(3,490 Views)

DRock,

I wasn't able to delete the User Group because I had the "not deletable" property flag set.  Once removed, itworks perfectly.  Thanks for your help.

 

Goldee

0 Kudos
Message 4 of 5
(3,484 Views)
Good catch, goldee!  I'm glad to see it's working!
Derrick S.
Product Manager
NI DIAdem
National Instruments
0 Kudos
Message 5 of 5
(3,478 Views)