Move AllGroupsExt into redox_users and Prevent Unintended Behavior
I think the functionality that's provided by
AllGroupsExt is valuable enough that it could possibly be used by other users of redox_users. It should probably be moved out of this crate and into that one.
@omac777 Brought up a couple of good points:
- for atomicity's sake, all groups should exist before you add the user to the existing groups
- ensure when adding user to a group, the user should not [be in the group] beforehand. [If] the user already exists, return an error condition useralreadyexists of some sort and recover gracefully continuing to add the user to other groups.
There's a chance without doing the above that you will be adding the user to some groups, but the non-existing group will fail the operation and the user might not get added to the remaining existing groups.
There's a chance that you might double-add a user to a group the way things are read.
For all the situations in this crate, error conditions are always fatal. However, if/when these functions get moved, they should be improved in these ways to prevent these situations from happening, since one of these returning an error condition doesn't necessarily prevent a
save being called.