This commit is contained in:
Tony 2024-09-03 16:04:47 +08:00
parent 56f70c5337
commit d8de82efca

View File

@ -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;
};
@ -38,7 +38,7 @@ export class RolesGuard implements CanActivate {
context.getClass(),
]);
if (isPublic) return;
if (isPublic) return true;
const role = this.reflector.get<string>('role', context.getHandler());