User and Group structs Encapsulating Write as well as Read
Currently the User
and Group
structs only provide API's for getting things like all the groups/users on the system and getting access to that info, as well as checking password in User
's case.
What if a Group struct could also write to the group file, something like this:
let mut group = get_group_by_name("sudo");
group.users.push("my-user".to_string());
group.write();
The trouble is that I'm not sure how one would make sure to get writes correct, although this seems fairly necessary as this is a system API that should be used an awful lot, and should be fairly easy and intuitive to use, and difficult to break.