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
server 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
Available on not (target_family=wasm and target_os=unknown).
impl AuthIdentity for AdminDefaultUser
Available on not (
target_family=wasm and target_os=unknown).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
Available on not (target_family=wasm and target_os=unknown).
impl BaseUser for AdminDefaultUser
Available on not (
target_family=wasm and target_os=unknown).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<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl FullUser for AdminDefaultUser
Available on not (target_family=wasm and target_os=unknown).
impl FullUser for AdminDefaultUser
Available on not (
target_family=wasm and target_os=unknown).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() -> Self::Fields
fn new_fields() -> Self::Fields
Create a new field selector instance Read more
Source§fn primary_key(&self) -> Option<Self::PrimaryKey>
fn primary_key(&self) -> Option<Self::PrimaryKey>
Get the primary key value Read more
Source§fn primary_key_filter_value(pk: Self::PrimaryKey) -> FilterValue
fn primary_key_filter_value(pk: Self::PrimaryKey) -> FilterValue
Converts a primary key into a query filter value. Read more
Source§fn set_primary_key(&mut self, value: Self::PrimaryKey)
fn set_primary_key(&mut self, value: Self::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 primary_key_filter_value_from_str(value: &str) -> Result<FilterValue, Error>
fn primary_key_filter_value_from_str(value: &str) -> Result<FilterValue, Error>
Converts a route primary key into a query filter value. Read more
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 serialize_database_value(&self) -> Result<Value, Error>
fn serialize_database_value(&self) -> Result<Value, Error>
Serialize model fields for database writes.
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
Available on not (target_family=wasm and target_os=unknown).
impl PermissionsMixin for AdminDefaultUser
Available on not (
target_family=wasm and target_os=unknown).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
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§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> 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