diff --git a/package.json b/package.json index 0c6f1d7..4b5235c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ipwhitelist", - "version": "0.5.102", + "version": "0.5.103", "description": "IP WhiteList microservice for cloud provider", "main": "server.js", "scripts": { diff --git a/v2/src/config/index.js b/v2/src/config/index.js index 985c632..6f87983 100644 --- a/v2/src/config/index.js +++ b/v2/src/config/index.js @@ -9,7 +9,7 @@ // ═══════════════════════════════════════════════════════════════════════════════ module.exports = { - version: '0.5.99', + version: '0.5.100', // ── IAM ────────────────────────────────────────────────────────────────── iamUrl: process.env.V2_IAM_URL || 'https://auth-api.ngcloud.ru/api/v1/auth/user', diff --git a/v2/src/router/index.js b/v2/src/router/index.js index 43743e9..ebef8e6 100644 --- a/v2/src/router/index.js +++ b/v2/src/router/index.js @@ -41,9 +41,10 @@ function resolveContext(req, res, next) { req.clientId = isImpersonated ? u.impersonatedCompanyId : (u.activeClientId || u.clientId || ''); req.companyName = u.companyName || req.clientId; // Админ: пользователь с WZ01112 + включён toggle «Администратор» + // По умолчанию adminMode=true для админов (не надо нажимать toggle) const allCids = u.allClientIds || [u.clientId || '']; req.canAdmin = allCids.includes('WZ01112') || u.clientId === 'WZ01112' || !!u.isAdmin; - req.adminMode = !!u.adminMode; + req.adminMode = u.adminMode !== undefined ? !!u.adminMode : req.canAdmin; req.isAdmin = req.canAdmin && req.adminMode; req.isImpersonated = isImpersonated; req.impersonatedBy = isImpersonated ? u.email : null;