1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-08-09 04:22:45 +03:00

"Can request admin" flag on user

This commit is contained in:
Quentin Gliech
2023-10-09 18:30:36 +02:00
parent 05e167b917
commit 3cb8a26d95
18 changed files with 360 additions and 13 deletions

View File

@@ -123,6 +123,23 @@ pub trait UserRepository: Send + Sync {
///
/// Returns [`Self::Error`] if the underlying repository fails
async fn unlock(&mut self, user: User) -> Result<User, Self::Error>;
/// Set whether a [`User`] can request admin
///
/// Returns the [`User`] with the new `can_request_admin` value
///
/// # Parameters
///
/// * `user`: The [`User`] to update
///
/// # Errors
///
/// Returns [`Self::Error`] if the underlying repository fails
async fn set_can_request_admin(
&mut self,
user: User,
can_request_admin: bool,
) -> Result<User, Self::Error>;
}
repository_impl!(UserRepository:
@@ -137,4 +154,9 @@ repository_impl!(UserRepository:
async fn exists(&mut self, username: &str) -> Result<bool, Self::Error>;
async fn lock(&mut self, clock: &dyn Clock, user: User) -> Result<User, Self::Error>;
async fn unlock(&mut self, user: User) -> Result<User, Self::Error>;
async fn set_can_request_admin(
&mut self,
user: User,
can_request_admin: bool,
) -> Result<User, Self::Error>;
);