roles update
This commit is contained in:
@@ -66,6 +66,17 @@ export class AdminGuard implements CanActivate {
|
||||
}
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
export class RbacManageGuard implements CanActivate {
|
||||
canActivate(context: ExecutionContext): boolean {
|
||||
const request = context.switchToHttp().getRequest<{ adminUser?: AdminRequestUser }>();
|
||||
if (request.adminUser?.isSuperAdmin || request.adminUser?.canManageRoles) {
|
||||
return true;
|
||||
}
|
||||
throw new ForbiddenException('Недостаточно прав для управления ролями и правами');
|
||||
}
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
export class SuperAdminGuard implements CanActivate {
|
||||
canActivate(context: ExecutionContext): boolean {
|
||||
|
||||
Reference in New Issue
Block a user