12-08-2011 01:00 PM
I am developing a user manager for a deployment so that the production floor manager can add users as they are trained. I modified the simple OI to add a button "Manage users", which is implemented as a VI.
I have this pretty much working except when I add a user using the DisplayNewUserDialog, I don't see any way to access the groups that can be selected in the dialog. Selecting a group in the dialog apparently does nothing. I save the user object that gets passed back from the dialog and that "sticks". But the group selection doesn't stick nor do I see any way to access the selection. Using the DisplayEditUserDialog on the same user object does properly save selected group membership(s) without having to make an extra call.
I see that in the example CreateDeleteUsers.seq, there is a step "Add User to Group" which looks up the group by the name selected by the user. To paraphrase the steps:
I don't see how I can programmatically retrieve that group name ("Locals.GroupName" above) from the dialog box, nor from the user object that is returned from the dialog box. Is this a bug?
Solved! Go to Solution.
12-08-2011 05:00 PM
Update: I misunderstood the dialog somewhat. It allows you to copy privileges from a group, not select the group itself (although I still didn't see any evidence that the copied privileges stick either). Since I want to put a newly added member in the "Operator" group, I will have to train the floor supervisors to first add the user and then edit (using the edit dialog) to add the user to the correct group. I'm kind of happy with the VI. Here are some screen shots:
The current user cannot delete himself. If he has admin privileges, he can add and edit.
Users with admin privileges can select from the list of users (alphabetized) and add, delete, or edit.
Users without admin privileges can only change their own record, and only their password within that record.
12-08-2011 06:04 PM
Hi,
If you want to programmatically access the group names, use the following:
RunState.Engine.UsersFile.Data.UserTemplates
This is an array of the groups, so querying the name of all of the elements will give you all of the group names. You may want to have a second dialog appear after the users dialog which allows you to select a group for the newly created user, which contains a ring control populated with the elements of the UserTemplates property.
Hope this helps!
12-09-2011 11:04 AM
How do I get to in LabVIEW? I only see UserGroupList, UserList, and UserList(putRef) as properties for the UsersFile.
12-09-2011 01:29 PM
I figured out how to get the group list in LabVIEW:
12-09-2011 02:01 PM
Hi Gizmogal,
Your implementation will definately work. To access the RunState.Engine.UsersFile.Data.UserTemplates
property I mentioned, we need to use a lookup string:
12-09-2011 02:49 PM
Thanks! I tried both ways and got exactly the same results each way.
12-09-2011 03:02 PM
By the way, I did add a dialog to ask the administrator to select the new user's group from that list, which I then use to add the new user to the group membership, so that was the solution to my initial question.