pub struct User {
pub id: i64,
pub email: String,
pub password_hash: String,
pub is_active: bool,
pub role: String,
}Expand description
User record. Infrastructure, not an application model — extend user
data via a separate Profile struct, not by widening this one.
Fields§
§id: i64§email: String§password_hash: StringPHC-encoded argon2id hash. Never treat as plaintext, never log, never render in a template.
is_active: bool§role: StringImplementations§
Source§impl User
impl User
Sourcepub fn is_admin(&self) -> bool
pub fn is_admin(&self) -> bool
true when the user’s role column grants admin access.
Pre-0.10 this was a binary check against ROLE_ADMIN
("admin"). From 0.10.0 the gate consults
crate::admin::rbac::Role::from_role_string, so the legacy
"admin" value continues to grant access (resolves to
SuperAdmin) and the new role names ("superadmin",
"restricted_admin", "editor", "viewer") are recognised.
Unknown values, empty, or "user" still return false.
Trait Implementations§
impl StructuralPartialEq for User
Auto Trait Implementations§
impl Freeze for User
impl RefUnwindSafe for User
impl Send for User
impl Sync for User
impl Unpin for User
impl UnsafeUnpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more