feat(gps): фильтры heartbeat-эхо/valid=false/spike; доступ к GPS и Финансам — матрица на /users (пользователи+роли)

This commit is contained in:
2026-08-26 17:13:49 +03:00
parent 2fb7ad6606
commit ac4f89d42e
16 changed files with 431 additions and 227 deletions

View File

@@ -403,6 +403,16 @@ export const requirePermission = (...codes: string[]) => {
if (!has) {
return res.status(403).json({ error: 'Недостаточно прав' });
}
// Модульный флаг доступа к Финансам (users/roles.finance_access) —
// дополнительный ограничитель поверх права finance.*: только отбирает,
// не добавляет. DEFAULT true — при выкатке поведение не меняется.
if (codes.some((c) => c.startsWith('finance.'))) {
const { hasModuleAccess } = await import('../utils/module-access');
const allowed = await hasModuleAccess(req.user, 'finance');
if (!allowed) {
return res.status(403).json({ error: 'Нет доступа к модулю «Финансы»' });
}
}
next();
};
};