From 86a4d9b112b8a097d6f4ba48c913939a5315ddd9 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Tue, 14 Dec 2021 12:58:32 -0500 Subject: [PATCH] Adding modlog private site check. --- crates/api/src/site.rs | 6 ++++++ crates/api_common/src/site.rs | 1 + 2 files changed, 7 insertions(+) diff --git a/crates/api/src/site.rs b/crates/api/src/site.rs index 172e79be6..fdcd91cfe 100644 --- a/crates/api/src/site.rs +++ b/crates/api/src/site.rs @@ -77,6 +77,12 @@ impl Perform for GetModlog { ) -> Result { let data: &GetModlog = self; + let local_user_view = + get_local_user_view_from_jwt_opt(data.auth.as_ref(), context.pool(), context.secret()) + .await?; + + check_private_instance(&local_user_view, context.pool()).await?; + let community_id = data.community_id; let mod_person_id = data.mod_person_id; let page = data.page; diff --git a/crates/api_common/src/site.rs b/crates/api_common/src/site.rs index ea7682e22..b53b99d4f 100644 --- a/crates/api_common/src/site.rs +++ b/crates/api_common/src/site.rs @@ -72,6 +72,7 @@ pub struct GetModlog { pub community_id: Option, pub page: Option, pub limit: Option, + pub auth: Option>, } #[derive(Debug, Serialize, Deserialize)]