Struct some_auth::UserService
source · pub struct UserService<TAuthUser: AuthUser + Debug + Send + Sync> { /* private fields */ }Expand description
Provides access logic for specified AuthUser
Implementations§
source§impl<TAuthUser: AuthUser + Debug + Send + Sync> UserService<TAuthUser>
impl<TAuthUser: AuthUser + Debug + Send + Sync> UserService<TAuthUser>
sourcepub async fn create_user(
&self,
username: String,
password: String,
admin: bool,
) -> Result<i32, AuthError>
pub async fn create_user( &self, username: String, password: String, admin: bool, ) -> Result<i32, AuthError>
Creates new user and returns created id
sourcepub async fn update_own_password(
&self,
access_token: &str,
old_password: &str,
new_password: String,
) -> Result<(), AuthError>
pub async fn update_own_password( &self, access_token: &str, old_password: &str, new_password: String, ) -> Result<(), AuthError>
Updates password for user with provided access_token
sourcepub async fn update_user_password_by_admin(
&self,
admin_access_token: &str,
admin_password: &str,
target_user_id: i32,
target_user_new_password: String,
) -> Result<(), AuthError>
pub async fn update_user_password_by_admin( &self, admin_access_token: &str, admin_password: &str, target_user_id: i32, target_user_new_password: String, ) -> Result<(), AuthError>
Updates user password by provided admin admin_access_token.
Note that this method doesn’t use CredentialValidator for a new password validation to reset password to some default value for example
sourcepub async fn block_user(&self, username: &str) -> Result<(), AuthError>
pub async fn block_user(&self, username: &str) -> Result<(), AuthError>
Blocks user with provided username
Auto Trait Implementations§
impl<TAuthUser> Freeze for UserService<TAuthUser>
impl<TAuthUser> !RefUnwindSafe for UserService<TAuthUser>
impl<TAuthUser> Send for UserService<TAuthUser>
impl<TAuthUser> Sync for UserService<TAuthUser>
impl<TAuthUser> Unpin for UserService<TAuthUser>
impl<TAuthUser> !UnwindSafe for UserService<TAuthUser>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more