From fa126cf59de1a489ae5e56ba2b80309cf54819e5 Mon Sep 17 00:00:00 2001 From: hanzlamateen Date: Mon, 3 Jun 2024 16:03:24 +0500 Subject: [PATCH] Updated verify project permission hook to look for context.id as well --- .../server-core/src/hooks/verify-project-permission.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/server-core/src/hooks/verify-project-permission.ts b/packages/server-core/src/hooks/verify-project-permission.ts index 9d635f4d2e..fca3f19363 100644 --- a/packages/server-core/src/hooks/verify-project-permission.ts +++ b/packages/server-core/src/hooks/verify-project-permission.ts @@ -43,7 +43,14 @@ export default (types: string[]) => { if (!loggedInUser) throw new NotAuthenticated('No logged in user') - const projectId = context.params.query.projectId ?? context.data.projectId + let projectId = '' + if (context.params.query?.projectId) { + projectId = context.params.query.projectId + } else if (context.data?.projectId) { + projectId = context.data.projectId + } else if (context.id) { + projectId = context.id.toString() + } if (!projectId) throw new BadRequest('Missing project ID in request')