feat(gps): фильтры heartbeat-эхо/valid=false/spike; доступ к GPS и Финансам — матрица на /users (пользователи+роли)
This commit is contained in:
@@ -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();
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user