Membership refactor

Introduce deactivate, membership services

Move membership and user deactivation functions from api crate into those services
This commit is contained in:
dasha_uwu
2025-08-25 19:12:27 +05:00
parent 6810604629
commit 8e9c6661b2
28 changed files with 2318 additions and 2091 deletions

16
src/api/client/utils.rs Normal file
View File

@@ -0,0 +1,16 @@
use ruma::{RoomId, UserId};
use tuwunel_core::{Err, Result, warn};
use tuwunel_service::Services;
pub(crate) async fn invite_check(
services: &Services,
sender_user: &UserId,
room_id: &RoomId,
) -> Result {
if !services.users.is_admin(sender_user).await && services.config.block_non_admin_invites {
warn!("{sender_user} is not an admin and attempted to send an invite to {room_id}");
return Err!(Request(Forbidden("Invites are not allowed on this server.")));
}
Ok(())
}