From c4160c358d3959ee20f64d81acc70e2b169c6518 Mon Sep 17 00:00:00 2001 From: Jaehyeon Kim Date: Mon, 1 Jul 2024 14:55:49 +0900 Subject: [PATCH] fix(be): inject user role in groud-member-guard (#1744) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - GroupMemberGuard에서 group이 OPEN_SPACE_ID이면 로그인 상태여도 user role이 주입되지 않는 문제 해결 --- apps/backend/libs/auth/src/roles/group-member.guard.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/backend/libs/auth/src/roles/group-member.guard.ts b/apps/backend/libs/auth/src/roles/group-member.guard.ts index 762eeca687..9a26da8c0d 100644 --- a/apps/backend/libs/auth/src/roles/group-member.guard.ts +++ b/apps/backend/libs/auth/src/roles/group-member.guard.ts @@ -31,7 +31,7 @@ export class GroupMemberGuard implements CanActivate { : parseInt(request.query.groupId as string) } - if (groupId === OPEN_SPACE_ID) { + if (!request.user && groupId === OPEN_SPACE_ID) { return true } @@ -40,7 +40,7 @@ export class GroupMemberGuard implements CanActivate { const userRole = (await this.service.getUserRole(user.id)).role user.role = userRole } - if (user.isAdmin() || user.isSuperAdmin()) { + if (user.isAdmin() || user.isSuperAdmin() || groupId === OPEN_SPACE_ID) { return true }