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

@@ -190,6 +190,12 @@ export function registerAuthCoreRoutes(router: Router): void {
return res.status(401).json({ success: false, error: 'Пользователь не найден' });
}
const permissions = await storage.getAppRolePermissions(user.appRole);
// Эффективный доступ к модулям (GPS/Финансы) — флаг пользователя OR роли OR admin
const { hasModuleAccess } = await import("../utils/module-access");
const moduleAccess = {
gps: await hasModuleAccess(user as any, "gps"),
finance: await hasModuleAccess(user as any, "finance"),
};
res.json({
success: true,
user: {
@@ -200,6 +206,7 @@ export function registerAuthCoreRoutes(router: Router): void {
middleName: user.middleName,
appRole: user.appRole,
permissions,
moduleAccess,
organization: user.organization ? {
id: user.organization.id,
name: user.organization.name,