pub struct AdminUser {
pub id: Uuid,
pub email: String,
pub password_hash: String,
pub display_name: String,
pub active: bool,
pub email_verified_at: Option<Timestamp>,
pub created_at: Timestamp,
}Expand description
Shipped credential model with unique email, Argon2id PHC hash, display name,
and active flag; belongs to no tenant. PasswordAuth stores the email,
and looks it up, trimmed and lowercased, so one address holds one account whatever case it is
typed in; a resource that edits the email must store it the same way.
Its PanelModel leave out the hash, so a resource over the panel’s
admins lists them. A resource’s edit form that changes an admin’s email or password hash ends
that admin’s sessions, pending sign-ins, reset links and pending email change in the same
transaction; a custom action that changes them does not, and calls
revoke_sessions_for_user itself; one that changes active
to false ends them at the admin’s next request.
Fields§
§id: Uuid§email: String§password_hash: StringArgon2id hash in PHC string format; never stores the plaintext.
display_name: String§active: boolfalse denies login and panel access immediately.
email_verified_at: Option<Timestamp>When the account proved it reads email; None until it does, and again after the
email changes. Read only by a panel with
Auth::email_verification.
created_at: TimestampImplementations§
Source§impl AdminUser
impl AdminUser
Sourcepub fn fields() -> AdminUserFields<AdminUser>
pub fn fields() -> AdminUserFields<AdminUser>
Returns a handle used to reference AdminUser’s fields when building query expressions.
Sourcepub async fn get_by_id(
executor: &mut dyn Executor,
id: impl IntoExpr<<Uuid as Field>::ExprTarget>,
) -> Result<AdminUser, Error>
pub async fn get_by_id( executor: &mut dyn Executor, id: impl IntoExpr<<Uuid as Field>::ExprTarget>, ) -> Result<AdminUser, Error>
Fetches the single AdminUser where id matches, erroring if none exists.
Sourcepub fn update_by_id(
id: impl IntoExpr<<Uuid as Field>::ExprTarget>,
) -> AdminUserUpdate
pub fn update_by_id( id: impl IntoExpr<<Uuid as Field>::ExprTarget>, ) -> AdminUserUpdate
Returns a builder that updates the AdminUser where id matches.
Sourcepub async fn delete_by_id(
executor: &mut dyn Executor,
id: impl IntoExpr<<Uuid as Field>::ExprTarget>,
) -> Result<(), Error>
pub async fn delete_by_id( executor: &mut dyn Executor, id: impl IntoExpr<<Uuid as Field>::ExprTarget>, ) -> Result<(), Error>
Deletes the AdminUser where id matches.
Sourcepub fn filter_by_id(
id: impl IntoExpr<<Uuid as Field>::ExprTarget>,
) -> AdminUserQuery
pub fn filter_by_id( id: impl IntoExpr<<Uuid as Field>::ExprTarget>, ) -> AdminUserQuery
Returns a query selecting the AdminUser records where id matches.
Sourcepub async fn get_by_email(
executor: &mut dyn Executor,
email: impl IntoExpr<<String as Field>::ExprTarget>,
) -> Result<AdminUser, Error>
pub async fn get_by_email( executor: &mut dyn Executor, email: impl IntoExpr<<String as Field>::ExprTarget>, ) -> Result<AdminUser, Error>
Fetches the single AdminUser where email matches, erroring if none exists.
Sourcepub fn update_by_email(
email: impl IntoExpr<<String as Field>::ExprTarget>,
) -> AdminUserUpdate
pub fn update_by_email( email: impl IntoExpr<<String as Field>::ExprTarget>, ) -> AdminUserUpdate
Returns a builder that updates the AdminUser where email matches.
Sourcepub async fn delete_by_email(
executor: &mut dyn Executor,
email: impl IntoExpr<<String as Field>::ExprTarget>,
) -> Result<(), Error>
pub async fn delete_by_email( executor: &mut dyn Executor, email: impl IntoExpr<<String as Field>::ExprTarget>, ) -> Result<(), Error>
Deletes the AdminUser where email matches.
Sourcepub fn filter_by_email(
email: impl IntoExpr<<String as Field>::ExprTarget>,
) -> AdminUserQuery
pub fn filter_by_email( email: impl IntoExpr<<String as Field>::ExprTarget>, ) -> AdminUserQuery
Returns a query selecting the AdminUser records where email matches.
Sourcepub fn create() -> AdminUserCreate
pub fn create() -> AdminUserCreate
Returns a builder that inserts a new AdminUser record.
Typically constructed through the toasty::create! macro.
Sourcepub fn create_many() -> CreateMany<AdminUser>
pub fn create_many() -> CreateMany<AdminUser>
Returns a builder that inserts multiple AdminUser records at once.
Sourcepub fn update(&mut self) -> AdminUserUpdate<&mut AdminUser>
pub fn update(&mut self) -> AdminUserUpdate<&mut AdminUser>
Returns a builder that updates this AdminUser record in place.
Source§impl AdminUser
impl AdminUser
Sourcepub fn upsert_by_id(
id: impl IntoExpr<<Uuid as Field>::ExprTarget>,
) -> AdminUserUpsertById
pub fn upsert_by_id( id: impl IntoExpr<<Uuid as Field>::ExprTarget>, ) -> AdminUserUpsertById
Returns a builder that creates AdminUser or updates the record whose id constraint matches.
The target arguments initialize a new record and remain unchanged when an existing record is updated.
Source§impl AdminUser
impl AdminUser
Sourcepub fn upsert_by_email(
email: impl IntoExpr<<String as Field>::ExprTarget>,
) -> AdminUserUpsertByEmail
pub fn upsert_by_email( email: impl IntoExpr<<String as Field>::ExprTarget>, ) -> AdminUserUpsertByEmail
Returns a builder that creates AdminUser or updates the record whose email constraint matches.
The target arguments initialize a new record and remain unchanged when an existing record is updated.
Source§impl AdminUser
impl AdminUser
Sourcepub fn columns() -> AdminUserColumns
pub fn columns() -> AdminUserColumns
Each field the default table or detail page of AdminUser shows, as a FieldColumn: placed as it is, the column the derive picks there, with the field’s #[columns(..)] keys; through a kind method, such as .text() or .toggle(), that column type’s own builder over the field.
Trait Implementations§
Source§impl Load for AdminUser
impl Load for AdminUser
Source§fn reload(target: &mut AdminUser, value: Value) -> Result<(), Error>
fn reload(target: &mut AdminUser, value: Value) -> Result<(), Error>
§fn ty_relation() -> Type
fn ty_relation() -> Type
stmt::Type] used when this type appears as a relation
target. The default delegates to ty().§fn load_relation(value: Value) -> Result<Self::Output, Error>
fn load_relation(value: Value) -> Result<Self::Output, Error>
Source§impl Model for AdminUser
impl Model for AdminUser
Source§type Query<__T> = AdminUserQuery<__T>
type Query<__T> = AdminUserQuery<__T>
Source§type UpdateQuery = AdminUserUpdate
type UpdateQuery = AdminUserUpdate
Source§type PrimaryKey = Uuid
type PrimaryKey = Uuid
Source§type ManyField<__Origin> = AdminUserListFields<__Origin>
type ManyField<__Origin> = AdminUserListFields<__Origin>
Source§type OneField<__Origin, __Target> = AdminUserFields<__Origin, __Target>
type OneField<__Origin, __Target> = AdminUserFields<__Origin, __Target>
Source§fn register(model_set: &mut ModelSet)
fn register(model_set: &mut ModelSet)
ModelSet]. Read moreSource§fn new_path<__Origin>(
path: Path<__Origin, AdminUser>,
) -> <AdminUser as Model>::Path<__Origin>
fn new_path<__Origin>( path: Path<__Origin, AdminUser>, ) -> <AdminUser as Model>::Path<__Origin>
Path] targeting this model.Source§fn new_many_field<__Origin>(
path: Path<__Origin, List<AdminUser>>,
) -> AdminUserListFields<__Origin>
fn new_many_field<__Origin>( path: Path<__Origin, List<AdminUser>>, ) -> AdminUserListFields<__Origin>
ManyField from a path targeting a list
of this model.Source§fn find_by_primary_key(
id: Expr<<AdminUser as Model>::PrimaryKey>,
) -> <AdminUser as Model>::Query<List<AdminUser>>
fn find_by_primary_key( id: Expr<<AdminUser as Model>::PrimaryKey>, ) -> <AdminUser as Model>::Query<List<AdminUser>>
Source§fn wrap_query<__T>(stmt: Query<__T>) -> <AdminUser as Model>::Query<__T>
fn wrap_query<__T>(stmt: Query<__T>) -> <AdminUser as Model>::Query<__T>
Query in this model’s
query builder, preserving the result shape T. This is the single
constructor generic code uses to build any query shape; callers narrow
at the statement level (.one(), .first()) before wrapping.Source§fn query_one(
query: <AdminUser as Model>::Query<List<AdminUser>>,
) -> <AdminUser as Model>::Query<AdminUser>
fn query_one( query: <AdminUser as Model>::Query<List<AdminUser>>, ) -> <AdminUser as Model>::Query<AdminUser>
Source§fn query_first(
query: <AdminUser as Model>::Query<List<AdminUser>>,
) -> <AdminUser as Model>::Query<Option<AdminUser>>
fn query_first( query: <AdminUser as Model>::Query<List<AdminUser>>, ) -> <AdminUser as Model>::Query<Option<AdminUser>>
Source§fn field_name_to_id(name: &str) -> FieldId
fn field_name_to_id(name: &str) -> FieldId
FieldId]. Read more§fn new_root_path() -> Self::Path<Self>
fn new_root_path() -> Self::Path<Self>
§fn path_field<U>(index: usize) -> Path<Self, U>
fn path_field<U>(index: usize) -> Path<Self, U>
Path] from this model to the field at index.§fn path_model_list() -> Path<List<Self>, List<Self>>
fn path_model_list() -> Path<List<Self>, List<Self>>
Path] rooted at a list of this model, used as the root of
has-many relation scopes.§fn new_create() -> Self::Create
fn new_create() -> Self::Create
Source§impl PanelModel for AdminUser
impl PanelModel for AdminUser
Source§const TENANT_COLUMNS: &'static [&'static str]
const TENANT_COLUMNS: &'static [&'static str]
Source§const UNLOADS_RELATIONS: bool = true
const UNLOADS_RELATIONS: bool = true
Source§fn detail() -> Detail<AdminUser>
fn detail() -> Detail<AdminUser>
Source§fn bare(&self) -> AdminUser
fn bare(&self) -> AdminUser
Deferred relation unloaded rather than copying its records.Source§impl PanelUser for AdminUser
impl PanelUser for AdminUser
Source§fn user_id(&self) -> String
fn user_id(&self) -> String
Authenticator::find_by_id receives. Any string fits.Source§fn display_name(&self) -> &str
fn display_name(&self) -> &str
Source§fn email(&self) -> Option<&str>
fn email(&self) -> Option<&str>
Source§fn can_access_panel(&self, _panel: &PanelId) -> bool
fn can_access_panel(&self, _panel: &PanelId) -> bool
panel. A user who may not answers 403, indistinguishable from
bad credentials at login. Every user type answers it: a sign-up on one panel writes an
account every panel over the same user type looks up. Read moreSource§fn subtitle(&self) -> Option<&str>
fn subtitle(&self) -> Option<&str>
Source§fn tenants(&self) -> &[Membership]
fn tenants(&self) -> &[Membership]
default_tenant
until the user selects another. Defaults to none: the user has no tenant. Read moreSource§fn default_tenant(&self) -> Option<TenantId>
fn default_tenant(&self) -> Option<TenantId>
tenants, such as one the user picks on their profile page and the app
stores. Defaults to none: the first of tenants.Source§fn time_zone(&self) -> Option<TimeZone>
fn time_zone(&self) -> Option<TimeZone>
DateColumn day and its DateFilter days.
Defaults to none: the panel’s time_zone.Source§fn locale(&self) -> Option<Locale>
fn locale(&self) -> Option<Locale>
fr. Defaults to none: the
browser’s best match among the panel’s locales, else its
default. A locale matches the closest the panel offers, as fr-CA reads fr; one with no
match counts as none. A locale the user picks from the shell’s language menu outranks this
one for their pages, while their mails still read this one, unless the authenticator
stores the pick through Authenticator::store_locale for this method to read. Read moreSource§impl PasswordAccount for AdminUser
The shipped account PasswordAuth signs in by default. An account
whose active is false signs in nowhere and gets no reset link.
impl PasswordAccount for AdminUser
The shipped account PasswordAuth signs in by default. An account
whose active is false signs in nowhere and gets no reset link.
Source§fn email() -> Lens<AdminUser, String>
fn email() -> Lens<AdminUser, String>
Source§fn password_hash() -> Lens<AdminUser, String>
fn password_hash() -> Lens<AdminUser, String>
hash_password writes it.Source§fn email_verified_at() -> Lens<AdminUser, Option<Timestamp>>
fn email_verified_at() -> Lens<AdminUser, Option<Timestamp>>
None until it does, and again after the
email changes. Every email change writes it; only a panel with
Auth::email_verification reads it.Source§async fn sign_in(
self,
_cx: &Cx,
_ex: &mut dyn Executor,
) -> Result<Option<AdminUser>, Error>
async fn sign_in( self, _cx: &Cx, _ex: &mut dyn Executor, ) -> Result<Option<AdminUser>, Error>
ex, or None when it no longer
signs in, such as a deactivated account: its login fails as a wrong password does, its
sessions end at their next request, and it gets no reset link. Read moreSource§fn profile_errors(user: &Self::User, profile: &Profile) -> FieldErrors<Profile>
fn profile_errors(user: &Self::User, profile: &Profile) -> FieldErrors<Profile>
user, such as a new email on an account
whose sign-in details are locked. Defaults to none. It runs before the current password is
checked, and the page renders each error under its field’s control. profile.email is as
typed: compare it through normalize_email, as the stored email
is spelled.Source§impl UpdateTarget for &mut AdminUser
impl UpdateTarget for &mut AdminUser
Source§fn to_update_stmt(&mut self, assignments: Assignments) -> Update<AdminUser>
fn to_update_stmt(&mut self, assignments: Assignments) -> Update<AdminUser>
Source§impl ViaTarget for AdminUser
impl ViaTarget for AdminUser
Source§type Query = AdminUserQuery
type Query = AdminUserQuery
Source§type Path<__Origin> = <AdminUser as Model>::ManyField<__Origin>
type Path<__Origin> = <AdminUser as Model>::ManyField<__Origin>
#[has_many(via = …)] field’s accessor returns,
parameterized by the origin model. Mirrors Model::Path for the
via-many case. Read moreSource§fn new_path<__Origin>(
path: Path<__Origin, List<AdminUser>>,
) -> <AdminUser as ViaTarget>::Path<__Origin>
fn new_path<__Origin>( path: Path<__Origin, List<AdminUser>>, ) -> <AdminUser as ViaTarget>::Path<__Origin>
Path handle from the typed path reaching this
terminal. A model terminal wraps the path in its chainable ManyField; a
scalar terminal is a leaf, so the path is the handle.Source§fn via_field_ty(singular: Name, path: Path) -> FieldTy
fn via_field_ty(singular: Name, path: Path) -> FieldTy
FieldTy::Via] for a #[has_many(via = …)] field whose
terminal element type is Self. Read moreAuto Trait Implementations§
impl Freeze for AdminUser
impl RefUnwindSafe for AdminUser
impl Send for AdminUser
impl Sync for AdminUser
impl Unpin for AdminUser
impl UnsafeUnpin for AdminUser
impl UnwindSafe for AdminUser
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
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> ErasedDestructor for Twhere
T: 'static,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<M> RelationOneField for Mwhere
M: Model,
impl<M> RelationOneField for Mwhere
M: Model,
§type One = <M as Model>::Query<M>
type One = <M as Model>::Query<M>
<Target as Model>::Query<Target>; for nullable impls it is
<Target as Model>::Query<Option<Target>>.§type Expr = M
type Expr = M
Self::Target for non-nullable impls and
Option<Self::Target> for nullable impls.§fn make_one(
query: <<M as RelationOneField>::Target as Model>::Query<List<<M as RelationOneField>::Target>>,
) -> <M as RelationOneField>::One
fn make_one( query: <<M as RelationOneField>::Target as Model>::Query<List<<M as RelationOneField>::Target>>, ) -> <M as RelationOneField>::One
Query<Model> for non-nullable impls and
Query<Option<Model>> for nullable impls. Read more§fn reload(target: &mut Self, value: Value) -> Result<(), Error>
fn reload(target: &mut Self, value: Value) -> Result<(), Error>
§fn has_one_relation_field_ty(
pair: Option<FieldId>,
via: Option<Path>,
) -> FieldTy
fn has_one_relation_field_ty( pair: Option<FieldId>, via: Option<Path>, ) -> FieldTy
FieldTy] for a HasOne relation field, given an
optional paired BelongsTo field on the target model resolved
from #[has_one(pair = <field>)]. When None, the linker selects
the pair by searching the target for a unique BelongsTo back to
the source. Read more§fn belongs_to_relation_field_ty(foreign_key: ForeignKey) -> FieldTy
fn belongs_to_relation_field_ty(foreign_key: ForeignKey) -> FieldTy
FieldTy] for a BelongsTo relation field, given the
foreign key resolved from the field’s #[belongs_to(...)] attribute.