Trait AuthRepository

Source
pub trait AuthRepository<TAuthUser: AuthUser + Debug + Send + Sync> {
Show 14 methods // Required methods fn add_user<'life0, 'life1, 'async_trait>( &'life0 self, user: &'life1 TAuthUser, ) -> Pin<Box<dyn Future<Output = Result<i32, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn update_user<'life0, 'life1, 'async_trait>( &'life0 self, user: &'life1 TAuthUser, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn get_users<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<TAuthUser>, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_user<'life0, 'async_trait>( &'life0 self, id: i32, ) -> Pin<Box<dyn Future<Output = Result<Option<TAuthUser>, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_user_by_username<'life0, 'life1, 'async_trait>( &'life0 self, username: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<TAuthUser>, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn update_user_refresh_token<'life0, 'life1, 'async_trait>( &'life0 self, user_id: i32, token_hash: &'life1 str, time_updated: DateTime<Utc>, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn get_user_refresh_token<'life0, 'async_trait>( &'life0 self, user_id: i32, ) -> Pin<Box<dyn Future<Output = Result<Option<String>, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn add_role<'life0, 'life1, 'async_trait>( &'life0 self, role: &'life1 Role, ) -> Pin<Box<dyn Future<Output = Result<i32, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn update_role<'life0, 'life1, 'async_trait>( &'life0 self, role: &'life1 Role, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn update_user_roles<'life0, 'life1, 'async_trait>( &'life0 self, user_id: i32, roles: &'life1 Vec<i32>, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn get_roles<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<Role>, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_role<'life0, 'async_trait>( &'life0 self, role_id: i32, ) -> Pin<Box<dyn Future<Output = Result<Option<Role>, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_role_by_name<'life0, 'life1, 'async_trait>( &'life0 self, role_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<Role>, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn get_user_roles<'life0, 'async_trait>( &'life0 self, user_id: i32, ) -> Pin<Box<dyn Future<Output = Result<Vec<Role>, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait;
}
Expand description

Auth repository which is used in [UserService]

Required Methods§

Source

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

returns created id

Source

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

Source

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

Source

fn get_user<'life0, 'async_trait>( &'life0 self, id: i32, ) -> Pin<Box<dyn Future<Output = Result<Option<TAuthUser>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

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

Source

fn update_user_refresh_token<'life0, 'life1, 'async_trait>( &'life0 self, user_id: i32, token_hash: &'life1 str, time_updated: DateTime<Utc>, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

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

returns token’s hash

Source

fn add_role<'life0, 'life1, 'async_trait>( &'life0 self, role: &'life1 Role, ) -> Pin<Box<dyn Future<Output = Result<i32, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

returns created id

Source

fn update_role<'life0, 'life1, 'async_trait>( &'life0 self, role: &'life1 Role, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

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

Updates user’s roles with new set of roles and clears all existing user’s roles if they are not present in roles param.

Source

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

Source

fn get_role<'life0, 'async_trait>( &'life0 self, role_id: i32, ) -> Pin<Box<dyn Future<Output = Result<Option<Role>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

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

Source

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

Implementors§