use space::Space; use crate::errors::ChatError; use crate::services::service::ChatService; pub async fn can_manage_space( _service: &ChatService, space: &Space, uid: i64, ) -> Result { Ok(space.can(uid, space::Capability::ManageChannels).await?) } pub async fn require_space_manager( _service: &ChatService, space: &Space, uid: i64, ) -> Result<(), ChatError> { if can_manage_space(_service, space, uid).await? { Ok(()) } else { Err(ChatError::Forbidden) } }