pub struct AdminDefaultUser {Show 13 fields
pub id: Uuid,
pub username: String,
pub email: String,
pub first_name: String,
pub last_name: String,
pub password_hash: Option<String>,
pub last_login: Option<DateTime<Utc>>,
pub is_active: bool,
pub is_staff: bool,
pub is_superuser: bool,
pub date_joined: DateTime<Utc>,
pub user_permissions: Vec<String>,
pub groups: Vec<String>,
}Available on
native and crate feature admin and not (target_family=wasm and target_os=unknown) only.Expand description
Internal user type for admin server function authentication.
This struct mirrors the fields of the deprecated DefaultUser but is
defined using the #[user] macro, which generates the required trait
implementations (BaseUser, FullUser, PermissionsMixin, etc.).
Model is implemented manually since admin operates on the same
auth_user table as the original DefaultUser.
Fields§
§id: UuidUnique identifier.
username: StringLogin username.
email: StringEmail address.
first_name: StringFirst name.
last_name: StringLast name.
password_hash: Option<String>Hashed password (None if not set).
last_login: Option<DateTime<Utc>>Timestamp of last login.
is_active: boolWhether the user account is active.
is_staff: boolWhether the user has staff privileges.
is_superuser: boolWhether the user has superuser privileges.
date_joined: DateTime<Utc>Timestamp when the user joined.
user_permissions: Vec<String>List of permission codenames assigned to this user.
groups: Vec<String>List of group names this user belongs to.
Trait Implementations§
Source§impl AuthIdentity for AdminDefaultUser
impl AuthIdentity for AdminDefaultUser
Source§fn is_authenticated(&self) -> bool
fn is_authenticated(&self) -> bool
Returns whether this user is authenticated. Read more
Source§fn is_account_active(&self) -> bool
fn is_account_active(&self) -> bool
Returns whether this user account is active. Read more
Source§impl BaseUser for AdminDefaultUser
impl BaseUser for AdminDefaultUser
Source§type PrimaryKey = Uuid
type PrimaryKey = Uuid
The type of the primary key (e.g., Uuid, i64)
Source§type Hasher = Argon2Hasher
type Hasher = Argon2Hasher
The password hasher to use (e.g., Argon2Hasher)
Source§fn get_username_field() -> &'static str
fn get_username_field() -> &'static str
Returns the name of the username field Read more
Source§fn get_username(&self) -> &str
fn get_username(&self) -> &str
Returns the username value
Source§fn password_hash(&self) -> Option<&str>
fn password_hash(&self) -> Option<&str>
Returns the hashed password, if set
Source§fn set_password_hash(&mut self, hash: String)
fn set_password_hash(&mut self, hash: String)
Sets the hashed password
Source§fn set_last_login(&mut self, time: DateTime<Utc>)
fn set_last_login(&mut self, time: DateTime<Utc>)
Sets the last login time
Source§fn normalize_username(username: &str) -> String
fn normalize_username(username: &str) -> String
Normalizes the username for consistent storage Read more
Source§fn set_password(&mut self, password: &str) -> Result<(), Error>
fn set_password(&mut self, password: &str) -> Result<(), Error>
Sets the password, hashing it first Read more
Source§fn check_password(&self, password: &str) -> Result<bool, Error>
fn check_password(&self, password: &str) -> Result<bool, Error>
Checks if the given password is correct Read more
Source§fn set_unusable_password(&mut self)
fn set_unusable_password(&mut self)
Sets an unusable password (user cannot log in with password) Read more
Source§fn has_usable_password(&self) -> bool
fn has_usable_password(&self) -> bool
Returns whether the user has a usable password Read more
Source§impl Clone for AdminDefaultUser
impl Clone for AdminDefaultUser
Source§fn clone(&self) -> AdminDefaultUser
fn clone(&self) -> AdminDefaultUser
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for AdminDefaultUser
impl Debug for AdminDefaultUser
Source§impl<'de> Deserialize<'de> for AdminDefaultUser
impl<'de> Deserialize<'de> for AdminDefaultUser
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<AdminDefaultUser, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<AdminDefaultUser, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl FullUser for AdminDefaultUser
impl FullUser for AdminDefaultUser
Source§fn first_name(&self) -> &str
fn first_name(&self) -> &str
Returns the first name
Source§fn is_superuser(&self) -> bool
fn is_superuser(&self) -> bool
Returns whether the user is a superuser Read more
Source§fn date_joined(&self) -> DateTime<Utc>
fn date_joined(&self) -> DateTime<Utc>
Returns when the user account was created
Source§fn get_full_name(&self) -> String
fn get_full_name(&self) -> String
Returns the full name (first name + last name) Read more
Source§fn get_short_name(&self) -> &str
fn get_short_name(&self) -> &str
Returns the short name (first name only) Read more
Source§impl Model for AdminDefaultUser
impl Model for AdminDefaultUser
Source§type PrimaryKey = Uuid
type PrimaryKey = Uuid
The primary key type
Source§fn table_name() -> &'static str
fn table_name() -> &'static str
Get the table name
Source§fn new_fields() -> <AdminDefaultUser as Model>::Fields
fn new_fields() -> <AdminDefaultUser as Model>::Fields
Create a new field selector instance Read more
Source§fn primary_key(&self) -> Option<<AdminDefaultUser as Model>::PrimaryKey>
fn primary_key(&self) -> Option<<AdminDefaultUser as Model>::PrimaryKey>
Get the primary key value Read more
Source§fn set_primary_key(&mut self, value: <AdminDefaultUser as Model>::PrimaryKey)
fn set_primary_key(&mut self, value: <AdminDefaultUser as Model>::PrimaryKey)
Set the primary key value
Source§fn primary_key_field() -> &'static str
fn primary_key_field() -> &'static str
Get the primary key field name
Source§fn composite_primary_key() -> Option<CompositePrimaryKey>
fn composite_primary_key() -> Option<CompositePrimaryKey>
Get composite primary key definition if this model uses composite PK Read more
Source§fn get_composite_pk_values(&self) -> HashMap<String, PkValue>
fn get_composite_pk_values(&self) -> HashMap<String, PkValue>
Get composite primary key values for this instance Read more
Source§fn relationship_metadata() -> Vec<RelationInfo>
fn relationship_metadata() -> Vec<RelationInfo>
Get relationship metadata for inspection Read more
Source§fn constraint_metadata() -> Vec<ConstraintInfo>
fn constraint_metadata() -> Vec<ConstraintInfo>
Get constraint metadata for inspection Read more
Source§fn objects() -> Self::Objectswhere
Self: Sized,
fn objects() -> Self::Objectswhere
Self: Sized,
Django-style objects manager accessor Read more
Source§impl PermissionsMixin for AdminDefaultUser
impl PermissionsMixin for AdminDefaultUser
Source§fn is_superuser(&self) -> bool
fn is_superuser(&self) -> bool
Returns whether this user is a superuser Read more
Source§fn user_permissions(&self) -> &[String]
fn user_permissions(&self) -> &[String]
Returns the list of permissions directly assigned to this user Read more
Source§fn get_user_permissions(&self) -> HashSet<String>
fn get_user_permissions(&self) -> HashSet<String>
Returns all permissions directly assigned to this user Read more
Source§fn get_group_permissions(&self) -> HashSet<String>
fn get_group_permissions(&self) -> HashSet<String>
Returns all permissions from groups this user belongs to Read more
Source§fn get_all_permissions(&self) -> HashSet<String>
fn get_all_permissions(&self) -> HashSet<String>
Returns all permissions for this user (user permissions + group permissions) Read more
Source§fn has_perm(&self, perm: &str) -> bool
fn has_perm(&self, perm: &str) -> bool
Checks if this user has a specific permission Read more
Source§impl Serialize for AdminDefaultUser
impl Serialize for AdminDefaultUser
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for AdminDefaultUser
impl RefUnwindSafe for AdminDefaultUser
impl Send for AdminDefaultUser
impl Sync for AdminDefaultUser
impl Unpin for AdminDefaultUser
impl UnsafeUnpin for AdminDefaultUser
impl UnwindSafe for AdminDefaultUser
Blanket Implementations§
Source§impl<T> AdminUser for Twhere
T: FullUser,
impl<T> AdminUser for Twhere
T: FullUser,
Source§fn is_superuser(&self) -> bool
fn is_superuser(&self) -> bool
Whether the user is a superuser (all permissions granted)
Source§fn get_username(&self) -> &str
fn get_username(&self) -> &str
The username for audit logging
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
Causes
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
Causes
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
Causes
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
Causes
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
Causes
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
Causes
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
Causes
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
Causes
self to use its UpperHex implementation when
Debug-formatted.Source§impl<T> ForceLoginUser for Twhere
T: AuthIdentity,
impl<T> ForceLoginUser for Twhere
T: AuthIdentity,
Source§fn session_user_id(&self) -> String
fn session_user_id(&self) -> String
The user ID to store as
"user_id" in session data.Source§fn session_is_superuser(&self) -> bool
fn session_is_superuser(&self) -> bool
Whether the user has superuser privileges. Defaults to
false.Source§fn session_is_staff(&self) -> bool
fn session_is_staff(&self) -> bool
Whether the user has staff privileges. Defaults to
false. Read moreSource§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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::RequestSource§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
type Err = Infallible
fn into_result(self) -> Result<T, <T as IntoResult<T>>::Err>
Creates a shared type from an unshared type.
Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Pipes by value. This is generally the method you want to use. Read more
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
Borrows
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
Mutably borrows
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
Borrows
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
Mutably borrows
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
Borrows
self, then passes self.deref() into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<E> ServerFnErrorAssertions<E> for Ewhere
E: Debug,
impl<E> ServerFnErrorAssertions<E> for Ewhere
E: Debug,
Source§fn should_contain_message(&self, expected: &str)where
E: Display,
fn should_contain_message(&self, expected: &str)where
E: Display,
Assert that the error message contains the specified text.
Source§fn should_have_message(&self, expected: &str)where
E: Display,
fn should_have_message(&self, expected: &str)where
E: Display,
Assert that the error message matches exactly.
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Immutable access to the
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
Mutable access to the
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
Immutable access to the
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
Mutable access to the
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Immutable access to the
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Mutable access to the
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
Calls
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
Calls
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
Calls
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
Calls
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
Calls
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
Calls
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
Calls
.tap_deref() only in debug builds, and is erased in release
builds.