pub trait AdminUser: Send + Sync {
// Required methods
fn is_active(&self) -> bool;
fn is_staff(&self) -> bool;
fn is_superuser(&self) -> bool;
fn get_username(&self) -> &str;
}Available on
server only.Expand description
Object-safe trait for admin permission checks.
This trait provides the minimum user information needed for admin
permission decisions, without exposing generic type parameters
from BaseUser or FullUser.
A blanket implementation is provided for all types implementing
FullUser, so any custom user model
with FullUser will automatically satisfy this trait.
For simpler user models that only implement BaseUser (without FullUser),
this trait can be implemented manually to enable admin authentication.
Required Methods§
Sourcefn is_superuser(&self) -> bool
fn is_superuser(&self) -> bool
Whether the user is a superuser (all permissions granted)
Sourcefn get_username(&self) -> &str
fn get_username(&self) -> &str
The username for audit logging
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".