Skip to main content

UserStore

Trait UserStore 

Source
pub trait UserStore:
    Send
    + Sync
    + 'static {
Show 15 methods // Required methods fn create_user<'life0, 'life1, 'async_trait>( &'life0 self, user: &'life1 User, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn get_user_by_id<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<User>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn get_user_by_email<'life0, 'life1, 'async_trait>( &'life0 self, email: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<User>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn update_user<'life0, 'life1, 'async_trait>( &'life0 self, user: &'life1 User, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn list_users<'life0, 'life1, 'async_trait>( &'life0 self, limit: i64, offset: i64, search: Option<&'life1 str>, ) -> Pin<Box<dyn Future<Output = Result<Vec<User>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn count_users<'life0, 'life1, 'async_trait>( &'life0 self, search: Option<&'life1 str>, ) -> Pin<Box<dyn Future<Output = Result<i64>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn delete_user<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn set_password_hash<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, user_id: &'life1 str, hash: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn get_password_hash<'life0, 'life1, 'async_trait>( &'life0 self, user_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn list_passkeys<'life0, 'life1, 'async_trait>( &'life0 self, user_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<PasskeyCred>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn add_passkey<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, user_id: &'life1 str, cred: &'life2 PasskeyCred, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn remove_passkey<'life0, 'life1, 'async_trait>( &'life0 self, credential_id: &'life1 [u8], ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn link_upstream<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, user_id: &'life1 str, provider: &'life2 str, subject: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait; fn get_user_by_upstream<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, provider: &'life1 str, subject: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Option<User>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn list_upstream_for_user<'life0, 'life1, 'async_trait>( &'life0 self, user_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<(String, String)>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait;
}
Expand description

CRUD over auth.users, auth.user_upstream, auth.passkeys.

Methods that touch passwords go through this trait too — the password module hashes the plaintext, then asks the store to persist the resulting hash.

Required Methods§

Source

fn create_user<'life0, 'life1, 'async_trait>( &'life0 self, user: &'life1 User, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn get_user_by_id<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<User>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn get_user_by_email<'life0, 'life1, 'async_trait>( &'life0 self, email: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<User>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn update_user<'life0, 'life1, 'async_trait>( &'life0 self, user: &'life1 User, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn list_users<'life0, 'life1, 'async_trait>( &'life0 self, limit: i64, offset: i64, search: Option<&'life1 str>, ) -> Pin<Box<dyn Future<Output = Result<Vec<User>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Admin: paginated user list. limit is clamped by the impl; offset may be 0. search is an optional case-insensitive substring match on email (or display_name when email is NULL). Returns rows sorted by created_at DESC.

Source

fn count_users<'life0, 'life1, 'async_trait>( &'life0 self, search: Option<&'life1 str>, ) -> Pin<Box<dyn Future<Output = Result<i64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Admin: total user count (after applying search if provided). Used by the dashboard’s pagination + the Lua wrapper.

Source

fn delete_user<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Admin: hard-delete a user row + cascade dependents. Returns Ok(true) iff a row was removed. The schema’s ON DELETE CASCADE foreign keys handle the dependents (auth.passkeys, auth.sessions, auth.user_upstream).

Source

fn set_password_hash<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, user_id: &'life1 str, hash: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source

fn get_password_hash<'life0, 'life1, 'async_trait>( &'life0 self, user_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn list_passkeys<'life0, 'life1, 'async_trait>( &'life0 self, user_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<PasskeyCred>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn add_passkey<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, user_id: &'life1 str, cred: &'life2 PasskeyCred, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source

fn remove_passkey<'life0, 'life1, 'async_trait>( &'life0 self, credential_id: &'life1 [u8], ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn get_user_by_upstream<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, provider: &'life1 str, subject: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Option<User>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source

fn list_upstream_for_user<'life0, 'life1, 'async_trait>( &'life0 self, user_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<(String, String)>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Admin: list every (provider, subject) link for a user. Used by the dashboard’s user-detail pane to show federated identities.

Implementors§