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());