pub struct UserConfig {
pub additional_fields: Option<IndexMap<String, UserFieldConfig>>,
}Expand description
Application user schema.
Fields§
§additional_fields: Option<IndexMap<String, UserFieldConfig>>Public field policies. None preserves omission; Some(IndexMap::new()) is explicitly empty.
Implementations§
Source§impl UserConfig
impl UserConfig
Sourcepub async fn storage_fields_for_adapter(
&self,
input: FieldMap,
create: bool,
supports_native_json: bool,
native_json_field: impl Fn(&str) -> bool,
) -> AuthResult<FieldMap>
pub async fn storage_fields_for_adapter( &self, input: FieldMap, create: bool, supports_native_json: bool, native_json_field: impl Fn(&str) -> bool, ) -> AuthResult<FieldMap>
Apply storage policies before converting JSON for the selected adapter.
Sourcepub async fn storage_fields_with_binding(
&self,
input: FieldMap,
create: bool,
bind: impl Fn(&str, &UserFieldConfig, Value) -> AuthResult<Value>,
) -> AuthResult<FieldMap>
pub async fn storage_fields_with_binding( &self, input: FieldMap, create: bool, bind: impl Fn(&str, &UserFieldConfig, Value) -> AuthResult<Value>, ) -> AuthResult<FieldMap>
Bind transformed fields to an adapter without repeating defaults or application transforms.
Source§impl UserConfig
impl UserConfig
Sourcepub async fn organization_storage_fields(
&self,
core: FieldMap,
extras: FieldMap,
create: bool,
) -> AuthResult<FieldMap>
pub async fn organization_storage_fields( &self, core: FieldMap, extras: FieldMap, create: bool, ) -> AuthResult<FieldMap>
Apply configured policies once to logical core fields and application fields.
The adapter owns id; custom field attributes cannot replace its policy.
Sourcepub fn parse_organization_input(
&self,
input: &FieldMap,
prefix: &str,
partial: bool,
) -> AuthResult<FieldMap>
pub fn parse_organization_input( &self, input: &FieldMap, prefix: &str, partial: bool, ) -> AuthResult<FieldMap>
Validate Organization route fields without applying adapter defaults or transforms.
Sourcepub async fn output_fields(&self, storage: &FieldMap) -> AuthResult<FieldMap>
pub async fn output_fields(&self, storage: &FieldMap) -> AuthResult<FieldMap>
Apply the adapter’s field mapping and output transforms before route visibility filtering.
Sourcepub async fn output_fields_many(
&self,
storage: &[FieldMap],
) -> AuthResult<Vec<FieldMap>>
pub async fn output_fields_many( &self, storage: &[FieldMap], ) -> AuthResult<Vec<FieldMap>>
Project a database result while retaining row order and per-row field order.
Sourcepub fn filter_returned_fields(&self, fields: &mut FieldMap)
pub fn filter_returned_fields(&self, fields: &mut FieldMap)
Apply only returned flags to fields already projected by the adapter.
Source§impl UserConfig
impl UserConfig
Sourcepub async fn organization_output_records(
&self,
records: Vec<AdapterRecord>,
supports_native_json: bool,
) -> AuthResult<Vec<FieldMap>>
pub async fn organization_output_records( &self, records: Vec<AdapterRecord>, supports_native_json: bool, ) -> AuthResult<Vec<FieldMap>>
Project Organization rows in one batch while retaining adapter-owned IDs.
Sourcepub async fn organization_output_records_then<R: Send, F>(
&self,
records: Vec<AdapterRecord>,
supports_native_json: bool,
complete: impl Fn(usize, FieldMap) -> F + Sync,
) -> AuthResult<Vec<R>>
pub async fn organization_output_records_then<R: Send, F>( &self, records: Vec<AdapterRecord>, supports_native_json: bool, complete: impl Fn(usize, FieldMap) -> F + Sync, ) -> AuthResult<Vec<R>>
Continue each Organization row after projection without cancelling started peers.
Sourcepub async fn organization_output_records_batches_then<V: Send, R: Send, F>(
&self,
records: Vec<AdapterRecord>,
supports_native_json: bool,
decode: impl Fn(usize, FieldMap) -> AuthResult<V> + Sync,
complete: impl Fn(Vec<(usize, V)>) -> F + Sync,
) -> AuthResult<Vec<R>>
pub async fn organization_output_records_batches_then<V: Send, R: Send, F>( &self, records: Vec<AdapterRecord>, supports_native_json: bool, decode: impl Fn(usize, FieldMap) -> AuthResult<V> + Sync, complete: impl Fn(Vec<(usize, V)>) -> F + Sync, ) -> AuthResult<Vec<R>>
Decode ready Organization rows before continuing their synchronous adapter reads together.
Sourcepub fn record_storage_key<'a>(&'a self, name: &'a str) -> &'a str
pub fn record_storage_key<'a>(&'a self, name: &'a str) -> &'a str
Resolve a logical field in an adapter-owned record.
Sourcepub async fn project_record(
&self,
storage: &FieldMap,
supports_native_json: bool,
supports_native_dates: bool,
) -> AuthResult<FieldMap>
pub async fn project_record( &self, storage: &FieldMap, supports_native_json: bool, supports_native_dates: bool, ) -> AuthResult<FieldMap>
Project a raw adapter record without retaining unmapped storage field names.
Sourcepub async fn project_records(
&self,
storage: &[FieldMap],
supports_native_json: bool,
supports_native_dates: bool,
) -> AuthResult<Vec<FieldMap>>
pub async fn project_records( &self, storage: &[FieldMap], supports_native_json: bool, supports_native_dates: bool, ) -> AuthResult<Vec<FieldMap>>
Project raw adapter records together without retaining unmapped storage field names.
Sourcepub async fn project_records_then<R: Send, F>(
&self,
storage: &[FieldMap],
supports_native_json: bool,
supports_native_dates: bool,
complete: impl Fn(usize, FieldMap) -> F + Sync,
) -> AuthResult<Vec<R>>
pub async fn project_records_then<R: Send, F>( &self, storage: &[FieldMap], supports_native_json: bool, supports_native_dates: bool, complete: impl Fn(usize, FieldMap) -> F + Sync, ) -> AuthResult<Vec<R>>
Complete each successfully projected row without cancelling other started rows. The original row index remains available for adapter-owned association data.
Sourcepub async fn project_records_batches_then<R: Send, F>(
&self,
storage: &[FieldMap],
supports_native_json: bool,
supports_native_dates: bool,
complete: impl Fn(Vec<(usize, FieldMap)>) -> F + Sync,
) -> AuthResult<Vec<R>>
pub async fn project_records_batches_then<R: Send, F>( &self, storage: &[FieldMap], supports_native_json: bool, supports_native_dates: bool, complete: impl Fn(Vec<(usize, FieldMap)>) -> F + Sync, ) -> AuthResult<Vec<R>>
Continue ready raw records as a batch, retaining each original row index.
Sourcepub async fn record_storage_fields_for_adapter(
&self,
input: FieldMap,
create: bool,
supports_native_json: bool,
native_json_field: impl Fn(&str) -> bool,
) -> AuthResult<FieldMap>
pub async fn record_storage_fields_for_adapter( &self, input: FieldMap, create: bool, supports_native_json: bool, native_json_field: impl Fn(&str) -> bool, ) -> AuthResult<FieldMap>
Apply adapter input policies once to a complete logical record or update patch.
Native adapter writes do not run HTTP input validation or remove input: false fields.
Sourcepub async fn record_storage_fields_with_binding(
&self,
input: FieldMap,
create: bool,
bind: impl Fn(&str, &UserFieldConfig, Value) -> AuthResult<Value>,
) -> AuthResult<FieldMap>
pub async fn record_storage_fields_with_binding( &self, input: FieldMap, create: bool, bind: impl Fn(&str, &UserFieldConfig, Value) -> AuthResult<Value>, ) -> AuthResult<FieldMap>
Bind a complete record after its storage policies, while retaining force-allowed IDs.
Sourcepub async fn record_output_fields(
&self,
core: FieldMap,
storage: &FieldMap,
supports_native_json: bool,
supports_native_dates: bool,
) -> AuthResult<FieldMap>
pub async fn record_output_fields( &self, core: FieldMap, storage: &FieldMap, supports_native_json: bool, supports_native_dates: bool, ) -> AuthResult<FieldMap>
Project stored values without applying endpoint visibility or decoding replacement types. The caller must invoke this after the write and before cache writes or database after hooks.
Sourcepub async fn project_adapter_records(
&self,
records: Vec<AdapterRecord>,
supports_native_json: bool,
supports_native_dates: bool,
) -> AuthResult<Vec<FieldMap>>
pub async fn project_adapter_records( &self, records: Vec<AdapterRecord>, supports_native_json: bool, supports_native_dates: bool, ) -> AuthResult<Vec<FieldMap>>
Project extracted records in row order, interleaving synchronous callbacks by field.
Sourcepub async fn project_adapter_records_with_capabilities(
&self,
records: Vec<AdapterRecord>,
capabilities: FieldOutputCapabilities,
supports_native_dates: bool,
) -> AuthResult<Vec<FieldMap>>
pub async fn project_adapter_records_with_capabilities( &self, records: Vec<AdapterRecord>, capabilities: FieldOutputCapabilities, supports_native_dates: bool, ) -> AuthResult<Vec<FieldMap>>
Project adapter fields with the database’s JSON, array, boolean, and date conversions.
Sourcepub async fn project_adapter_records_then<R: Send, F>(
&self,
records: Vec<AdapterRecord>,
supports_native_json: bool,
supports_native_dates: bool,
complete: impl Fn(usize, FieldMap) -> F + Sync,
) -> AuthResult<Vec<R>>
pub async fn project_adapter_records_then<R: Send, F>( &self, records: Vec<AdapterRecord>, supports_native_json: bool, supports_native_dates: bool, complete: impl Fn(usize, FieldMap) -> F + Sync, ) -> AuthResult<Vec<R>>
Complete each extracted row after its output policies, retaining the original row order. A failed projection skips its completion; other started rows still finish before an error returns.
Sourcepub async fn project_adapter_records_batches_then<R: Send, F>(
&self,
records: Vec<AdapterRecord>,
supports_native_json: bool,
supports_native_dates: bool,
complete: impl Fn(Vec<(usize, FieldMap)>) -> F + Sync,
) -> AuthResult<Vec<R>>
pub async fn project_adapter_records_batches_then<R: Send, F>( &self, records: Vec<AdapterRecord>, supports_native_json: bool, supports_native_dates: bool, complete: impl Fn(Vec<(usize, FieldMap)>) -> F + Sync, ) -> AuthResult<Vec<R>>
Continue ready extracted records together, retaining their original row indices.
Source§impl UserConfig
impl UserConfig
Sourcepub fn stored_username_field(
&self,
fields: &FieldMap,
name: &str,
) -> AuthResult<Option<Option<String>>>
pub fn stored_username_field( &self, fields: &FieldMap, name: &str, ) -> AuthResult<Option<Option<String>>>
Read one stored username field for the implicit adapter’s typed columns. Keep the storage entry so output transforms can observe the original stored value once.
Source§impl UserConfig
impl UserConfig
Sourcepub fn fields(&self) -> &IndexMap<String, UserFieldConfig>
pub fn fields(&self) -> &IndexMap<String, UserFieldConfig>
Runtime fields. An omitted map has no fields.
Sourcepub fn fields_mut(&mut self) -> &mut IndexMap<String, UserFieldConfig>
pub fn fields_mut(&mut self) -> &mut IndexMap<String, UserFieldConfig>
Configure fields, creating an explicitly present map when omitted.
Sourcepub fn parse_input(
&self,
input: &FieldMap,
create: bool,
) -> AuthResult<FieldMap>
pub fn parse_input( &self, input: &FieldMap, create: bool, ) -> AuthResult<FieldMap>
Parse public input. Updates omit missing fields and never apply creation defaults.
Sourcepub fn parse_provider_input(
&self,
profile: &FieldMap,
create: bool,
) -> AuthResult<FieldMap>
pub fn parse_provider_input( &self, profile: &FieldMap, create: bool, ) -> AuthResult<FieldMap>
Parse an OAuth provider profile without trusting protected application fields.
Sourcepub async fn storage_fields(
&self,
input: FieldMap,
create: bool,
) -> AuthResult<FieldMap>
pub async fn storage_fields( &self, input: FieldMap, create: bool, ) -> AuthResult<FieldMap>
Map configured fields to application storage columns and await adapter transforms.