Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mutability: create users and groups #42

Open
enaut opened this issue Sep 15, 2020 · 0 comments
Open

Mutability: create users and groups #42

enaut opened this issue Sep 15, 2020 · 0 comments

Comments

@enaut
Copy link

enaut commented Sep 15, 2020

I need to create users and groups from rust. Rather than implementing this in a separate crate I'd like to extend this crate. However I just learned rust and I probably need some conceptual guidance.

As users can be created already I guess a save_user method could work. So the workflow to create a user would be:

let mut user = User::new(1001, "peter", 1001);
user.save_to_passwd().expect("could not save the user");

The save method could also try to validate that the user does not exist yet.

There could also be the possibility to modify the entries of a user with set_param functions followed by a save_to_passwd. In this case I think it would be good to check that the user has not been changed while it was cached. If it was changed it should fail with an appropriate error.

Let me know what you think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant