Skip to main content

AdminUser

Struct AdminUser 

Source
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 ModelColumns 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: String

Argon2id hash in PHC string format; never stores the plaintext.

§display_name: String§active: bool

false 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: Timestamp

Implementations§

Source§

impl AdminUser

Source

pub fn fields() -> AdminUserFields<AdminUser>

Returns a handle used to reference AdminUser’s fields when building query expressions.

Source

pub async fn get_by_id( executor: &mut dyn Executor, id: impl IntoExpr<FieldExprTarget<Uuid>>, ) -> Result<AdminUser>

Fetches the single AdminUser where id matches, erroring if none exists.

Source

pub fn update_by_id(id: impl IntoExpr<FieldExprTarget<Uuid>>) -> AdminUserUpdate

Returns a builder that updates the AdminUser where id matches.

Source

pub async fn delete_by_id( executor: &mut dyn Executor, id: impl IntoExpr<FieldExprTarget<Uuid>>, ) -> Result<()>

Deletes the AdminUser where id matches.

Source

pub fn filter_by_id(id: impl IntoExpr<FieldExprTarget<Uuid>>) -> AdminUserQuery

Returns a query selecting the AdminUser records where id matches.

Source

pub async fn get_by_email( executor: &mut dyn Executor, email: impl IntoExpr<FieldExprTarget<String>>, ) -> Result<AdminUser>

Fetches the single AdminUser where email matches, erroring if none exists.

Source

pub fn update_by_email( email: impl IntoExpr<FieldExprTarget<String>>, ) -> AdminUserUpdate

Returns a builder that updates the AdminUser where email matches.

Source

pub async fn delete_by_email( executor: &mut dyn Executor, email: impl IntoExpr<FieldExprTarget<String>>, ) -> Result<()>

Deletes the AdminUser where email matches.

Source

pub fn filter_by_email( email: impl IntoExpr<FieldExprTarget<String>>, ) -> AdminUserQuery

Returns a query selecting the AdminUser records where email matches.

Source

pub fn create() -> AdminUserCreate

Returns a builder that inserts a new AdminUser record.

Typically constructed through the toasty::create! macro.

Source

pub fn create_many() -> CreateMany<AdminUser>

Returns a builder that inserts multiple AdminUser records at once.

Source

pub fn update(&mut self) -> AdminUserUpdate<&mut Self>

Returns a builder that updates this AdminUser record in place.

Source

pub fn all() -> AdminUserQuery

Returns a query that selects every AdminUser record.

Source

pub fn filter(expr: Expr<bool>) -> AdminUserQuery

Returns a query selecting the AdminUser records matching expr.

Source

pub fn delete(self) -> Delete<()>

Consumes this AdminUser and returns a statement that deletes its record.

Source§

impl AdminUser

Source

pub fn upsert_by_id( id: impl IntoExpr<FieldExprTarget<Uuid>>, ) -> 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

Source

pub fn upsert_by_email( email: impl IntoExpr<FieldExprTarget<String>>, ) -> 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.

Trait Implementations§

Source§

impl Assign<AdminUser> for AdminUser

Source§

fn into_assignment(self) -> Assignment<AdminUser>

Convert into an Assignment<T> value.
Source§

fn assign(self, assignments: &mut Assignments, projection: Projection)
where Self: Sized,

Record one or more assignments into the given [Assignments] map at the specified projection.
Source§

impl Clone for AdminUser

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AdminUser

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl IntoExpr<AdminUser> for AdminUser

Source§

fn into_expr(self) -> Expr<AdminUser>

Consume self and produce an Expr<T>. Read more
Source§

fn by_ref(&self) -> Expr<AdminUser>

Produce an Expr<T> from a reference without consuming self. Read more
Source§

impl IntoStatement for &AdminUser

Source§

type Returning = AdminUser

The type this statement produces when executed.
Source§

fn into_statement(self) -> Statement<AdminUser>

Consume self and produce the Statement.
Source§

impl IntoStatement for &mut AdminUser

Source§

type Returning = AdminUser

The type this statement produces when executed.
Source§

fn into_statement(self) -> Statement<AdminUser>

Consume self and produce the Statement.
Source§

impl IntoStatement for AdminUser

Source§

type Returning = AdminUser

The type this statement produces when executed.
Source§

fn into_statement(self) -> Statement<AdminUser>

Consume self and produce the Statement.
Source§

impl Load for AdminUser

Source§

type Output = AdminUser

The concrete type produced by load. Read more
Source§

fn ty() -> Type

Returns the stmt::Type that describes values of this type.
Source§

fn load(value: Value) -> Result<Self>

Deserialize a database Value into Self::Output. Read more
Source§

fn reload(target: &mut Self, value: Value) -> Result<()>

Reload the value in-place from a value returned by the database. Read more
Source§

fn ty_relation() -> Type

Returns the stmt::Type used when this type appears as a relation target. The default delegates to ty().
Source§

fn load_relation(value: Value) -> Result<Self::Output, Error>

Deserialize a value that was loaded as a relation target. Read more
Source§

impl Model for AdminUser

Source§

type Query<__T> = AdminUserQuery<__T>

Query builder for this model, parameterized by what it executes to. Read more
Source§

type Create = AdminUserCreate

Create builder type for this model
Source§

type Update<'a> = AdminUserUpdate<&'a mut AdminUser>

Update builder type for this model
Source§

type UpdateQuery = AdminUserUpdate

Update by query builder type for this model
Source§

type Path<__Origin> = AdminUserFields<__Origin>

A typed path from Origin into this model.
Source§

type PrimaryKey = Uuid

The model’s primary key type. Read more
Source§

type ManyField<__Origin> = AdminUserListFields<__Origin>

The field accessor type used when this model appears as the “many” side of a has-many relation, parameterized by the origin model.
Source§

type OneField<__Origin, __Target> = AdminUserFields<__Origin, __Target>

The field accessor for a singular relation to this model, parameterized by the origin and path target. Read more
Source§

fn id() -> ModelId

Unique identifier for this model within the schema. Read more
Source§

fn schema() -> Model

Returns the schema definition for this model.
Source§

fn register(model_set: &mut ModelSet)

Register this model and all models reachable through its fields into the given ModelSet. Read more
Source§

fn new_path<__Origin>(path: Path<__Origin, Self>) -> Self::Path<__Origin>

Construct a model path from a Path targeting this model.
Source§

fn new_many_field<__Origin>( path: Path<__Origin, List<Self>>, ) -> AdminUserListFields<__Origin>

Construct a ManyField from a path targeting a list of this model.
Source§

fn find_by_primary_key(id: Expr<Self::PrimaryKey>) -> Self::Query<List<Self>>

Build a query that filters this model by its primary key. Read more
Source§

fn wrap_query<__T>(stmt: Query<__T>) -> Self::Query<__T>

Wrap a raw statement-level 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: Self::Query<List<Self>>) -> Self::Query<Self>

Narrow a list query to a single-row query (errors at exec time if no row matches). Used by the codegen for non-nullable relation accessors.
Source§

fn query_first(query: Self::Query<List<Self>>) -> Self::Query<Option<Self>>

Narrow a list query to an optional single-row query. Used by the codegen for nullable relation accessors.
Source§

fn field_name_to_id(name: &str) -> FieldId

Map a field name string to its FieldId. Read more
Source§

fn new_root_path() -> Self::Path<Self>

Construct a path rooted at this model.
Source§

fn path_root() -> Path<Self, Self>

An identity Path rooted at this model. Read more
Source§

fn path_field<U>(index: usize) -> Path<Self, U>

A Path from this model to the field at index.
Source§

fn path_model_list() -> Path<List<Self>, List<Self>>

An identity Path rooted at a list of this model, used as the root of has-many relation scopes.
Source§

fn new_create() -> Self::Create

Return a fresh, default-initialized create builder.
Source§

impl ModelCodegen for AdminUser

Source§

fn to_relation_expr(&self, fields: &[&str]) -> Expr

Encode referenced fields so the engine can resolve a relation key.
Source§

fn new_one_field<__Origin, __Target>( path: Path<__Origin, __Target>, ) -> Self::OneField<__Origin, __Target>

Construct the field accessor for a singular relation to this model.
Source§

impl ModelColumns for AdminUser

Source§

const TENANT_COLUMNS: &'static [&'static str]

The model’s TenantId fields, by name: the derive lists each field typed TenantId or Option<TenantId>. Mounting a panel refuses a resource over a model that lists one and declares no tenancy, which would serve every tenant’s rows. It has no default, so an impl by hand states it.
Source§

const UNLOADS_RELATIONS: bool = true

Whether bare leaves out every relation the model holds. The derive answers true when each relation is a Deferred one; an impl by hand keeps this default unless its bare leaves them out. Read more
Source§

fn table() -> Table<AdminUser>

The default table, which lists no column here.
Source§

fn detail() -> Detail<AdminUser>

The default detail page, which lists no column here: a resource serving the view page then declares its own, else mounting refuses it.
Source§

fn bare(&self) -> Self

A copy of the record without its relations, holding its own fields: the derive builds it field by field, leaving each Deferred relation unloaded rather than copying its records.
Source§

fn references(&self) -> Vec<(&'static str, Option<String>)>

The record’s foreign keys and TenantId fields, by name, each spelled as the database stores it, None where it holds nothing. Read more
Source§

fn version(&self) -> Option<u64>

The record’s #[version] counter, or None for a model without one. Read more
Source§

impl PanelUser for AdminUser

Source§

fn user_id(&self) -> String

The stable key the session stores and Authenticator::find_by_id receives. Any string fits.
Source§

fn display_name(&self) -> &str

The name the user menu shows.
Source§

fn email(&self) -> Option<&str>

The address the account stores, which mail meant for the account goes to: a reset link, a verification link, a sign-in code. Defaults to none: the account gets no mail.
Source§

fn can_access_panel(&self, _panel: &str) -> bool

Whether the user may enter the panel at panel, its prefix with one leading slash and none trailing: /admin for Panel::new("admin"). 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 more
Source§

fn subtitle(&self) -> Option<&str>

The muted line under the name in the user menu, such as an email or a role. Defaults to none.
Source§

fn tenants(&self) -> &[Membership]

The tenants the user may act for, in the order the tenant switcher lists them. A session acts for the default_tenant until the user selects another. Defaults to none: the user has no tenant. Read more
Source§

fn default_tenant(&self) -> Option<TenantId>

The tenant a session acts for until the user selects another, while it is one of 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>

The time zone the user reads and enters wall-clock times in: a timestamp’s control, its DateColumn day and its DateFilter days. Defaults to none: the panel’s time_zone.
Source§

fn locale(&self) -> Option<Locale>

The locale the user reads the panel and their mails in, such as 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 more
Source§

impl UpdateTarget for &mut AdminUser

Source§

type Returning = AdminUser

The type parameter for the typed Update<R> statement.
Source§

fn to_update_stmt(&mut self, assignments: Assignments) -> Update<AdminUser>

Build the update statement by combining this target’s selection with the provided assignments. Read more
Source§

fn apply_result(self, value: Value) -> Result<()>

Apply the result of an update operation. Read more
Source§

impl ViaTarget for AdminUser

Source§

type Query = AdminUserQuery

The query builder returned by the generated has-many-via navigation method.
Source§

type Path<__Origin> = <AdminUser as Model>::ManyField<__Origin>

The typed path handle a #[has_many(via = …)] field’s accessor returns, parameterized by the origin model. Mirrors Model::Path for the via-many case. Read more
Source§

fn new_path<__Origin>( path: Path<__Origin, List<AdminUser>>, ) -> Self::Path<__Origin>

Build the 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

Build the FieldTy::Via for a #[has_many(via = …)] field whose terminal element type is Self. Read more
Source§

fn make_via_query(assoc: Association<List<AdminUser>>) -> Self::Query

Wrap a via-field association into the navigation query. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Assign<Arc<T>> for T
where T: IntoExpr<T>,

Source§

fn into_assignment(self) -> Assignment<Arc<T>>

Convert into an Assignment<T> value.
Source§

fn assign(self, assignments: &mut Assignments, projection: Projection)
where Self: Sized,

Record one or more assignments into the given [Assignments] map at the specified projection.
Source§

impl<T> Assign<Box<T>> for T
where T: IntoExpr<T>,

Source§

fn into_assignment(self) -> Assignment<Box<T>>

Convert into an Assignment<T> value.
Source§

fn assign(self, assignments: &mut Assignments, projection: Projection)
where Self: Sized,

Record one or more assignments into the given [Assignments] map at the specified projection.
Source§

impl<T> Assign<Option<T>> for T
where T: IntoExpr<T>,

Source§

fn into_assignment(self) -> Assignment<Option<T>>

Convert into an Assignment<T> value.
Source§

fn assign(self, assignments: &mut Assignments, projection: Projection)
where Self: Sized,

Record one or more assignments into the given [Assignments] map at the specified projection.
Source§

impl<T> Assign<Rc<T>> for T
where T: IntoExpr<T>,

Source§

fn into_assignment(self) -> Assignment<Rc<T>>

Convert into an Assignment<T> value.
Source§

fn assign(self, assignments: &mut Assignments, projection: Projection)
where Self: Sized,

Record one or more assignments into the given [Assignments] map at the specified projection.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoExpr<Arc<T>> for T
where T: IntoExpr<T>,

Source§

fn into_expr(self) -> Expr<Arc<T>>

Consume self and produce an Expr<T>. Read more
Source§

fn by_ref(&self) -> Expr<Arc<T>>

Produce an Expr<T> from a reference without consuming self. Read more
Source§

impl<T> IntoExpr<Box<T>> for T
where T: IntoExpr<T>,

Source§

fn into_expr(self) -> Expr<Box<T>>

Consume self and produce an Expr<T>. Read more
Source§

fn by_ref(&self) -> Expr<Box<T>>

Produce an Expr<T> from a reference without consuming self. Read more
Source§

impl<T> IntoExpr<Option<T>> for T
where T: IntoExpr<T>,

Source§

fn into_expr(self) -> Expr<Option<T>>

Consume self and produce an Expr<T>. Read more
Source§

fn by_ref(&self) -> Expr<Option<T>>

Produce an Expr<T> from a reference without consuming self. Read more
Source§

impl<T> IntoExpr<Rc<T>> for T
where T: IntoExpr<T>,

Source§

fn into_expr(self) -> Expr<Rc<T>>

Consume self and produce an Expr<T>. Read more
Source§

fn by_ref(&self) -> Expr<Rc<T>>

Produce an Expr<T> from a reference without consuming self. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<M> RelationOneField for M
where M: Model,

Source§

const DEFERRED: bool = false

Whether the field stores its value in a deferred load slot.
Source§

const NULLABLE: bool = false

Whether the field is nullable (i.e. wrapped in Option).
Source§

type Target = M

The target model that this field references.
Source§

type One = <M as Model>::Query<M>

The query type produced by the relation accessor. For non-nullable impls this is <Target as Model>::Query<Target>; for nullable impls it is <Target as Model>::Query<Option<Target>>.
Source§

type Expr = M

The path target and expression type used in create/update setters. Resolves to Self::Target for non-nullable impls and Option<Self::Target> for nullable impls.
Source§

fn make_one( query: <<M as RelationOneField>::Target as Model>::Query<List<<M as RelationOneField>::Target>>, ) -> <M as RelationOneField>::One

Narrow a list query targeting the related model into the appropriate “one” query — Query<Model> for non-nullable impls and Query<Option<Model>> for nullable impls. Read more
Source§

fn reload(target: &mut Self, value: Value) -> Result<(), Error>

Reloads this relation field from a returned value.
Source§

fn has_one_relation_field_ty( pair: Option<FieldId>, via: Option<Path>, ) -> FieldTy

Build the 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
Source§

fn belongs_to_relation_field_ty(foreign_key: ForeignKey) -> FieldTy

Build the FieldTy for a BelongsTo relation field, given the foreign key resolved from the field’s #[belongs_to(...)] attribute.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more