Skip to main content

UserView

Struct UserView 

Source
pub struct UserView {
Show 20 fields pub additional_fields: FieldMap, pub visible_fields: Option<BTreeSet<String>>, pub id: SchemaValue<String>, pub name: SchemaValue<Option<String>>, pub email: Option<String>, pub email_verified: bool, pub image: SchemaValue<Option<String>>, pub created_at: FieldDate, pub updated_at: FieldDate, pub is_anonymous: Option<bool>, pub phone_number: Option<String>, pub phone_number_verified: Option<bool>, pub username: Option<String>, pub display_username: Option<String>, pub two_factor_enabled: Option<bool>, pub role: Option<String>, pub banned: bool, pub ban_reason: Option<String>, pub ban_expires: Option<FieldDate>, pub metadata: FieldValue,
}
Expand description

Public user response shape.

Fields§

§additional_fields: FieldMap

Configured application fields after output transforms.

§visible_fields: Option<BTreeSet<String>>

Present optional core fields and enabled plugin fields. None preserves an unconfigured view.

§id: SchemaValue<String>§name: SchemaValue<Option<String>>§email: Option<String>§email_verified: bool§image: SchemaValue<Option<String>>§created_at: FieldDate§updated_at: FieldDate§is_anonymous: Option<bool>§phone_number: Option<String>§phone_number_verified: Option<bool>§username: Option<String>§display_username: Option<String>§two_factor_enabled: Option<bool>§role: Option<String>§banned: bool§ban_reason: Option<String>§ban_expires: Option<FieldDate>§metadata: FieldValue

Implementations§

Source§

impl UserView

Source

pub fn synthetic_output( data: FieldMap, config: &UserConfig, metadata: &MetadataMap, ) -> AuthResult<FieldMap>

Build an enumeration-safe signup response without adapter transforms or persistence.

Source

pub async fn with_fields<T: AuthUser>( user: &T, config: &UserConfig, metadata: &MetadataMap, ) -> AuthResult<Self>

Construct the public user shape from the active application and plugin schemas. Application model serialization is inspected only at this user boundary.

Source

pub async fn with_fields_for_adapter<T: AuthUser>( user: &T, config: &UserConfig, metadata: &MetadataMap, supports_native_json: bool, ) -> AuthResult<Self>

Source

pub async fn with_field_policies<T: AuthUser>( user: &T, adapter: &UserConfig, endpoint: &UserConfig, metadata: &MetadataMap, supports_native_json: bool, ) -> AuthResult<Self>

Apply adapter transforms once, then use the endpoint’s field visibility.

Source

pub async fn with_internal_fields<T: AuthUser>( user: &T, config: &UserConfig, metadata: &MetadataMap, ) -> AuthResult<Self>

Apply adapter transforms and active schemas without removing application-only fields. Use this view only for trusted callbacks, never for public responses.

Source

pub async fn with_internal_fields_for_adapter<T: AuthUser>( user: &T, config: &UserConfig, metadata: &MetadataMap, supports_native_json: bool, ) -> AuthResult<Self>

Source

pub async fn with_internal_fields_many_for_adapter<T: AuthUser>( users: &[T], config: &UserConfig, metadata: &MetadataMap, supports_native_json: bool, ) -> AuthResult<Vec<Self>>

Project a database result in row order, interleaving synchronous callbacks by field.

Source

pub async fn with_internal_fields_many_for_adapter_using<T: AuthUser>( users: &[T], config: &UserConfig, metadata: &MetadataMap, capabilities: FieldOutputCapabilities, read_extra: impl Fn(&T, &str, &UserFieldConfig) -> AuthResult<Option<Value>> + Sync, ) -> AuthResult<Vec<Self>>

Project database rows with raw callback values for unprojected additional fields. Some(Value::Null) preserves a present null; None retains the serialized source. Supplied non-reference extras use the adapter capabilities after their output callback. Native fields and completed adapter output do not use this accessor.

Source§

impl UserView

Source

pub fn from_model<T: AuthUser>(user: &T) -> AuthResult<Self>

Read an application model without applying adapter output transforms.

Trait Implementations§

Source§

impl AuthRecordFields for UserView

Source§

fn field_values(&self) -> AuthResult<FieldMap>

Source§

fn structured_clone( &self, context: &mut StructuredCloneContext, ) -> AuthResult<Self>

Deep-copy runtime objects through one graph context while retaining record state.
Source§

impl AuthUser for UserView

Source§

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

Plugin fields that the entity and store can read and persist. Read more
Source§

fn field_presence(&self) -> Option<&BTreeSet<String>>

Field presence for runtime records and signed snapshots. Database models use None. A missing optional core field differs from a present field containing JSON null.
Source§

fn projected_fields(&self) -> Option<&FieldMap>

Already projected application fields, for views reconstructed from session caches. Storage models return None so the output transform runs exactly once per database read.
Source§

fn id(&self) -> SchemaValue<Cow<'_, str>>

Source§

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

Source§

fn email_verified(&self) -> bool

Source§

fn created_at(&self) -> FieldDate

Source§

fn updated_at(&self) -> FieldDate

Source§

fn is_anonymous(&self) -> Option<bool>

Source§

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

Source§

fn phone_number_verified(&self) -> Option<bool>

Source§

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

Source§

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

Source§

fn two_factor_enabled(&self) -> bool

Source§

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

Source§

fn banned(&self) -> bool

Source§

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

Source§

fn ban_expires(&self) -> Option<FieldDate>

Source§

fn require_plugin_fields(plugin: &str, required: &[&str]) -> AuthResult<()>

Reject a plugin whose required fields are absent from this entity.
Source§

fn serialized_field_name(name: &str) -> &str

Resolve canonical field names to serialized application model fields.
Source§

impl Clone for UserView

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 UserView

Source§

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

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

impl<'de> Deserialize<'de> for UserView

Source§

fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<&UserView> for UserView

Source§

fn from(user: &UserView) -> Self

Converts to this type from the input type.
Source§

impl From<UserView> for FieldMap

Source§

fn from(user: UserView) -> Self

Converts to this type from the input type.
Source§

impl FromFieldMap for UserView

Source§

impl PartialEq for UserView

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for UserView

Source§

fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error>

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for UserView

Source§

impl TryFrom<FieldMap> for UserView

Source§

type Error = AuthError

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

fn try_from(fields: FieldMap) -> Result<Self, Self::Error>

Performs the conversion.

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> 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<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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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