pub struct User { /* private fields */ }Expand description
Represents a user account with all associated metadata.
This structure contains all the information needed to represent a user in the system, including their unique identifier, name, primary group, and hashed password with salt for security.
Implementations§
Source§impl User
impl User
Sourcepub fn new(
identifier: UserIdentifierInner,
name: String,
primary_group: GroupIdentifierInner,
hash: String,
salt: String,
) -> Self
pub fn new( identifier: UserIdentifierInner, name: String, primary_group: GroupIdentifierInner, hash: String, salt: String, ) -> Self
Creates a new user instance with the provided information.
§Arguments
Identifier- Unique numerical identifier for the userName- Human-readable usernamePrimary_group- Identifier of the user’s primary groupHash- Pre-computed SHA-512 hash of password+saltSalt- Random salt used for password hashing
§Returns
A new User_type instance with the provided data.
Sourcepub fn get_identifier(&self) -> UserIdentifier
pub fn get_identifier(&self) -> UserIdentifier
Sourcepub fn get_primary_group(&self) -> GroupIdentifier
pub fn get_primary_group(&self) -> GroupIdentifier
Returns the user’s primary group identifier.
§Returns
A GroupIdentifier containing the user’s primary group ID.
Sourcepub fn get_hash(&self) -> &str
pub fn get_hash(&self) -> &str
Returns the user’s password hash as a string slice.
§Returns
A string slice containing the SHA-512 hash of password+salt.
Sourcepub fn get_salt(&self) -> &str
pub fn get_salt(&self) -> &str
Returns the user’s salt as a string slice.
§Returns
A string slice containing the random salt used for password hashing.
Sourcepub fn set_primary_group(&mut self, primary_group: GroupIdentifierInner)
pub fn set_primary_group(&mut self, primary_group: GroupIdentifierInner)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for User
impl RefUnwindSafe for User
impl Send for User
impl Sync for User
impl Unpin for User
impl UnwindSafe for User
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more