From d8de82efca7782e2c429d038f3014e5e51bb4628 Mon Sep 17 00:00:00 2001 From: Tony Date: Tue, 3 Sep 2024 16:04:47 +0800 Subject: [PATCH] fix: BUG --- src/common/role.guard.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/common/role.guard.ts b/src/common/role.guard.ts index a76448f..e0c9065 100644 --- a/src/common/role.guard.ts +++ b/src/common/role.guard.ts @@ -21,7 +21,7 @@ const matchRole: (role: string, userRole: string) => boolean = ( if (!role) return true; // 如果是超级管理员或者管理员,则返回 true - if (userRole === 'admin') return; + if (userRole === 'admin') return true; return false; }; @@ -37,8 +37,8 @@ export class RolesGuard implements CanActivate { context.getHandler(), context.getClass(), ]); - - if (isPublic) return; + + if (isPublic) return true; const role = this.reflector.get('role', context.getHandler());