mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2025-06-29 23:24:35 +02:00
feat: Do not allow suspending admin users
This commit is contained in:
parent
8791a9b851
commit
cc864dc8bb
1 changed files with 3 additions and 0 deletions
|
@ -235,6 +235,9 @@ pub(super) async fn suspend(&self, user_id: String) -> Result {
|
|||
if !self.services.users.exists(&user_id).await {
|
||||
return Err!("User {user_id} does not exist.");
|
||||
}
|
||||
if self.services.users.is_admin(&user_id).await {
|
||||
return Err!("Admin users cannot be suspended.");
|
||||
}
|
||||
self.services.users.suspend_account(&user_id).await;
|
||||
|
||||
self.write_str(&format!("User {user_id} has been suspended."))
|
||||
|
|
Loading…
Add table
Reference in a new issue