From f99ad899c066165506f1b3af3519fe6949bb3e65 Mon Sep 17 00:00:00 2001 From: Ly Tuan Kiet Date: Sat, 30 Nov 2024 23:44:46 +0700 Subject: [PATCH] refactor: enhance user validation in CollaborationSessionSchema - Update user participation check to allow access for a specific user ID while maintaining restrictions for others. - This change aims to refine access control within collaboration sessions, ensuring that only authorized users can participate while allowing for specific exceptions. --- src/CollaborationSession/collaborationsession.schema.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/CollaborationSession/collaborationsession.schema.ts b/src/CollaborationSession/collaborationsession.schema.ts index 16b36a1..e065d5e 100644 --- a/src/CollaborationSession/collaborationsession.schema.ts +++ b/src/CollaborationSession/collaborationsession.schema.ts @@ -100,7 +100,11 @@ export class CollaborationSessionSchema extends PothosSchema { // }) // } // check if user is participant - if (!collaborationSession.collaboratorsIds.includes(ctx.http.me.id)) throw new Error('User not allowed') + if ( + !collaborationSession.collaboratorsIds.includes(ctx.http.me.id) && + ctx.http.me.id !== 'user_2nkDilSYEiljIraFGF9PENjILPr' + ) + throw new Error('User not allowed') return collaborationSession } /* ---------- use case 2 : center mentor get collaboration session by schedule date id --------- */