mas_storage::user

Trait UserRegistrationRepository

Source
pub trait UserRegistrationRepository: Send + Sync {
    type Error;

    // Required methods
    fn lookup<'life0, 'async_trait>(
        &'life0 mut self,
        id: Ulid,
    ) -> Pin<Box<dyn Future<Output = Result<Option<UserRegistration>, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn add<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 mut self,
        rng: &'life1 mut (dyn RngCore + Send),
        clock: &'life2 dyn Clock,
        username: String,
        ip_address: Option<IpAddr>,
        user_agent: Option<UserAgent>,
        post_auth_action: Option<Value>,
    ) -> Pin<Box<dyn Future<Output = Result<UserRegistration, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn set_display_name<'life0, 'async_trait>(
        &'life0 mut self,
        user_registration: UserRegistration,
        display_name: String,
    ) -> Pin<Box<dyn Future<Output = Result<UserRegistration, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn set_terms_url<'life0, 'async_trait>(
        &'life0 mut self,
        user_registration: UserRegistration,
        terms_url: Url,
    ) -> Pin<Box<dyn Future<Output = Result<UserRegistration, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn set_email_authentication<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        user_registration: UserRegistration,
        email_authentication: &'life1 UserEmailAuthentication,
    ) -> Pin<Box<dyn Future<Output = Result<UserRegistration, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn set_password<'life0, 'async_trait>(
        &'life0 mut self,
        user_registration: UserRegistration,
        hashed_password: String,
        version: u16,
    ) -> Pin<Box<dyn Future<Output = Result<UserRegistration, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn complete<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        clock: &'life1 dyn Clock,
        user_registration: UserRegistration,
    ) -> Pin<Box<dyn Future<Output = Result<UserRegistration, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

A UserRegistrationRepository helps interacting with UserRegistration saved in the storage backend

Required Associated Types§

Source

type Error

The error type returned by the repository

Required Methods§

Source

fn lookup<'life0, 'async_trait>( &'life0 mut self, id: Ulid, ) -> Pin<Box<dyn Future<Output = Result<Option<UserRegistration>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Lookup a UserRegistration by its ID

Returns None if no UserRegistration was found

§Parameters
§Errors

Returns Self::Error if the underlying repository fails

Source

fn add<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, rng: &'life1 mut (dyn RngCore + Send), clock: &'life2 dyn Clock, username: String, ip_address: Option<IpAddr>, user_agent: Option<UserAgent>, post_auth_action: Option<Value>, ) -> Pin<Box<dyn Future<Output = Result<UserRegistration, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Create a new UserRegistration session

Returns the newly created UserRegistration

§Parameters
  • rng: The random number generator to use
  • clock: The clock used to generate timestamps
  • username: The username of the user
  • ip_address: The IP address of the user agent, if any
  • user_agent: The user agent of the user agent, if any
  • post_auth_action: The post auth action to execute after the registration, if any
§Errors

Returns Self::Error if the underlying repository fails

Source

fn set_display_name<'life0, 'async_trait>( &'life0 mut self, user_registration: UserRegistration, display_name: String, ) -> Pin<Box<dyn Future<Output = Result<UserRegistration, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Set the display name of a UserRegistration

Returns the updated UserRegistration

§Parameters
  • user_registration: The UserRegistration to update
  • display_name: The display name to set
§Errors

Returns Self::Error if the underlying repository fails or if the registration is already completed

Source

fn set_terms_url<'life0, 'async_trait>( &'life0 mut self, user_registration: UserRegistration, terms_url: Url, ) -> Pin<Box<dyn Future<Output = Result<UserRegistration, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Set the terms URL of a UserRegistration

Returns the updated UserRegistration

§Parameters
  • user_registration: The UserRegistration to update
  • terms_url: The terms URL to set
§Errors

Returns Self::Error if the underlying repository fails or if the registration is already completed

Source

fn set_email_authentication<'life0, 'life1, 'async_trait>( &'life0 mut self, user_registration: UserRegistration, email_authentication: &'life1 UserEmailAuthentication, ) -> Pin<Box<dyn Future<Output = Result<UserRegistration, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Set the email authentication code of a UserRegistration

Returns the updated UserRegistration

§Parameters
§Errors

Returns Self::Error if the underlying repository fails or if the registration is already completed

Source

fn set_password<'life0, 'async_trait>( &'life0 mut self, user_registration: UserRegistration, hashed_password: String, version: u16, ) -> Pin<Box<dyn Future<Output = Result<UserRegistration, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Set the password of a UserRegistration

Returns the updated UserRegistration

§Parameters
  • user_registration: The UserRegistration to update
  • hashed_password: The hashed password to set
  • version: The version of the hashing scheme
§Errors

Returns Self::Error if the underlying repository fails or if the registration is already completed

Source

fn complete<'life0, 'life1, 'async_trait>( &'life0 mut self, clock: &'life1 dyn Clock, user_registration: UserRegistration, ) -> Pin<Box<dyn Future<Output = Result<UserRegistration, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Complete a UserRegistration

Returns the updated UserRegistration

§Parameters
  • clock: The clock used to generate timestamps
  • user_registration: The UserRegistration to complete
§Errors

Returns Self::Error if the underlying repository fails or if the registration is already completed

Implementations on Foreign Types§

Source§

impl<R> UserRegistrationRepository for Box<R>

Source§

type Error = <R as UserRegistrationRepository>::Error

Source§

fn lookup<'life0, 'async_trait>( &'life0 mut self, id: Ulid, ) -> Pin<Box<dyn Future<Output = Result<Option<UserRegistration>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn add<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, rng: &'life1 mut (dyn RngCore + Send), clock: &'life2 dyn Clock, username: String, ip_address: Option<IpAddr>, user_agent: Option<UserAgent>, post_auth_action: Option<Value>, ) -> Pin<Box<dyn Future<Output = Result<UserRegistration, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source§

fn set_display_name<'life0, 'async_trait>( &'life0 mut self, user_registration: UserRegistration, display_name: String, ) -> Pin<Box<dyn Future<Output = Result<UserRegistration, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn set_terms_url<'life0, 'async_trait>( &'life0 mut self, user_registration: UserRegistration, terms_url: Url, ) -> Pin<Box<dyn Future<Output = Result<UserRegistration, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn set_email_authentication<'life0, 'life1, 'async_trait>( &'life0 mut self, user_registration: UserRegistration, email_authentication: &'life1 UserEmailAuthentication, ) -> Pin<Box<dyn Future<Output = Result<UserRegistration, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn set_password<'life0, 'async_trait>( &'life0 mut self, user_registration: UserRegistration, hashed_password: String, version: u16, ) -> Pin<Box<dyn Future<Output = Result<UserRegistration, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn complete<'life0, 'life1, 'async_trait>( &'life0 mut self, clock: &'life1 dyn Clock, user_registration: UserRegistration, ) -> Pin<Box<dyn Future<Output = Result<UserRegistration, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Implementors§