feat: complete scheduled publishing, security remediation and DEV_TICKETS implementation
Deploy Canina / deploy (push) Successful in 2m29s
E2E Playwright Tests / Run Full E2E & Security Suites (push) Failing after 6s

This commit is contained in:
parsa committed 2026-09-29 01:15:33 +03:30
1 parent d6d4158cbe
commit efb3c473c4
35 files changed
+685 -185

No files matched your search

+17 -4
View File
@@ -46,10 +46,23 @@ export class RolesGuard implements CanActivate {
}
}
const userRoleLower = user.role.toLowerCase();
const hasRole = requiredRoles.some(
(r) => r.toLowerCase() === userRoleLower,
);
const normalizeRole = (r: string) => r.toLowerCase().replace(/[_-]/g, '');
const userRoleNorm = normalizeRole(user.role);
const hasRole = requiredRoles.some((r) => {
const requiredNorm = normalizeRole(r);
// Direct normalized match
if (requiredNorm === userRoleNorm) return true;
// Superadmin satisfies admin
if (
(userRoleNorm === 'superadmin' || userRoleNorm === 'adminsuper') &&
requiredNorm === 'admin'
) {
return true;
}
return false;
});
if (!hasRole) {
throw new ForbiddenException('سطح دسترسی شما کافی نیست');
}