Skip to content

Commit

Permalink
fix(be): inject user role in groud-member-guard (#1744)
Browse files Browse the repository at this point in the history
- GroupMemberGuard에서 group이 OPEN_SPACE_ID이면 로그인 상태여도 user role이 주입되지 않는 문제 해결
  • Loading branch information
Jaehyeon1020 authored Jul 1, 2024
1 parent 6263cb5 commit c4160c3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions apps/backend/libs/auth/src/roles/group-member.guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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
}

Expand Down

0 comments on commit c4160c3

Please sign in to comment.