Struct lrau::user::User [−][src]
The User struct stores information about an individual login.
Fields
username: String
This is then username / id of the user
password: String
This is the password of the user.
This is stores hashed with Argon2id.
permissions: Permissions
logged_in: Option<Instant>
This stores information about wether the user is logged in or not.
expire: Option<Duration>
This is how long until the user is expire.
Implementations
impl User
[src]
pub fn new_basic(
username: String,
password: String,
permissions: Permissions
) -> Self
[src]
username: String,
password: String,
permissions: Permissions
) -> Self
Creates a new user from an existing hash.
pub fn new(username: String, password: String, permissions: Permissions) -> Self
[src]
Creates a new user. The field password
is the unhashed password.
After this is suplied the program will hash it using the Argon2id
agorithm.
The username
field is any username which you wish to identify
the user by.
Permissions is a representation of the permissions for the user.
pub fn validate(&self, password: &str) -> bool
[src]
Validates a users password
pub fn log_in(&mut self, password: &str, expire: Duration) -> bool
[src]
Logs a user in
pub fn check_login(&self) -> bool
[src]
Checks if the user is logged in.
This does not check if the user has expired.
pub fn check_valid_login(&self) -> bool
[src]
Checks for a valid login. This makes sure the user is logged in and has a valid session.
pub fn get_permission(&self, path: &str, mut: bool) -> bool
[src]
Checks if a user has permissions to do something.
Note this does not check for a valid session.
pub fn get_valid_permissions(
&self,
path: &str,
mut: bool
) -> Result<bool, SessionExpired>
[src]
&self,
path: &str,
mut: bool
) -> Result<bool, SessionExpired>
Checks if the user has permissions to do something.
This function also checks if they have a valid
session and will return an Err
if they do not.
Trait Implementations
impl Clone for User
[src]
impl Debug for User
[src]
impl Eq for User
[src]
impl Hash for User
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Ord for User
[src]
fn cmp(&self, other: &User) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl PartialEq<User> for User
[src]
impl PartialOrd<User> for User
[src]
fn partial_cmp(&self, other: &User) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl StructuralEq for User
[src]
impl StructuralPartialEq for User
[src]
Auto Trait Implementations
impl RefUnwindSafe for User
impl Send for User
impl Sync for User
impl Unpin for User
impl UnwindSafe for User
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,