Skip to content

Mutability: create users and groups #42

Description

@enaut

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions