in reply to User Manager for Groups
I think you need to clarify, for yourself mostly, what it is you are trying to do here.
...i need to give access to some users in some groups....
Read, Write, Execute, Delete, Change permissions, Ownership.
This allows very fine grain control, but rapidly becomes a nightmare to administer.
When you add a new file or directory, you then need to track down all the users that need to have access by backtracking from some other file or directory set of ACLs/DACLs to find the users and groups that have access to that and then add the new file to each.
And when you add a new user, you then need to track down every file and directory and give this new user permissions to access every one individually.
This is what I think your asking for code to do in this post. It is the 'Wrong Way'. That way lies madness of a particularly insideous and nasty kind:)
You then make new Users members of this group and they gain all the right accesses to all the appropriate files in one simple step.
And when you add new files or directories, you just set it/them to be owned by the special group, and everyone who is a member of the group instantly has the right permissions.
As particle mentions above, Win32::FileSecurity will allow you to find out what permissions are set on individual files.
Specifically, the Get( $file_or_path, \%permission ); will get you a list of users and/or groups that have DACLs set for the given file.
You can then translate the masks returned for each user and group in the hash to the corresponding set of specific permission using the EnumerateRights( $mask, \@rights );
Win32::NetAdmin GroupGetMembers( ... ); will allow you to find the all the members for each group that has specific permissions, but you should really just apply any new permissions to the group rather than to the individual members of it.
Overall, if your currently using the former method, I strongly recommend you move to the latter method as soon as possible. From experience, I can assure you that the pain of the transition is more than compensated for by the ease of management once it is completed.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: User Manager for Groups
by rupesh (Hermit) on Jul 22, 2003 at 06:36 UTC |