pub struct AllUsers<A> { /* private fields */ }Expand description
AllUsers provides (borrowed) access to all the users on the system.
Note that this struct implements All for all of its access functions.
§Notes
Note that everything in this section also applies to AllGroups.
- If you mutate anything owned by an
AllUsers, you must call theAllUsers::savein order for those changes to be applied to the system. - The API here is kept small. Most mutating actions can be accomplished via
the
All::get_mut_by_idandAll::get_mut_by_namefunctions.
Implementations§
Source§impl AllUsers<Full>
impl AllUsers<Full>
Sourcepub fn authenticator(config: Config) -> Result<AllUsers<Full>, Error>
pub fn authenticator(config: Config) -> Result<AllUsers<Full>, Error>
If access to password related methods for the Users yielded by this
AllUsers is required, use this constructor.
Sourcepub fn add_user(&mut self, builder: UserBuilder) -> Result<&User<Full>, Error>
pub fn add_user(&mut self, builder: UserBuilder) -> Result<&User<Full>, Error>
Consumes a builder, adding a new user to this AllUsers. Returns a
reference to the created user.
Make sure to call AllUsers::save in order for the new user to be
applied to the system.
Note that the user’s password is set unset (see Unset vs Blank Passwords) during this call.
Also note that the user is not added to any groups when this builder is
consumed. In order to keep the system in a consistent state, it is
reccomended to also use an instance of AllGroups to update group
information when creating new users.
§Defaults
Fields not passed to the builder before calling this function are as follows:
uid:AllUsers::get_unique_idis called on self to get the next available id.gid:99. This is the default UID for the groupnobody. Note that the user is NOT added to this group in/etc/groups.name: The login name passed toUserBuilder::new.home:"/"shell:file:/bin/ion
Trait Implementations§
Source§impl<A> All for AllUsers<A>
impl<A> All for AllUsers<A>
Source§fn get_mut_by_name(
&mut self,
name: impl AsRef<str>,
) -> Option<&mut <Self as AllInner>::Gruser>
fn get_mut_by_name( &mut self, name: impl AsRef<str>, ) -> Option<&mut <Self as AllInner>::Gruser>
All::get_by_name.Source§fn get_mut_by_id(
&mut self,
id: usize,
) -> Option<&mut <Self as AllInner>::Gruser>
fn get_mut_by_id( &mut self, id: usize, ) -> Option<&mut <Self as AllInner>::Gruser>
All::get_by_id.Source§fn get_unique_id(&self) -> Option<usize>
fn get_unique_id(&self) -> Option<usize>
Source§fn remove_by_id(&mut self, id: usize) -> bool
fn remove_by_id(&mut self, id: usize) -> bool
All::remove_by_name.