From eb3c17cd68aae5ede64f2c07c4dbea0191b63c05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CNaeel=E2=80=9D?= Date: Mon, 15 Jun 2026 13:51:37 +0400 Subject: [PATCH] =?UTF-8?q?v0.5.106:=20=D1=84=D0=B8=D0=BA=D1=81=20?= =?UTF-8?q?=E2=80=94=20=D0=B0=D0=B4=D0=BC=D0=B8=D0=BD=20=D0=B2=D1=81=D0=B5?= =?UTF-8?q?=D0=B3=D0=B4=D0=B0=20=D0=B2=D0=B8=D0=B4=D0=B8=D1=82=20=D0=B2?= =?UTF-8?q?=D1=81=D0=B5=20=D0=BA=D0=BE=D0=BC=D0=BF=D0=B0=D0=BD=D0=B8=D0=B8?= =?UTF-8?q?,=20=D1=83=D0=B1=D1=80=D0=B0=D0=BD=20=D0=B4=D1=83=D0=B1=D0=BB?= =?UTF-8?q?=D1=8C=20(=D0=B0=D0=B4=D0=BC=D0=B8=D0=BD)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- v2/src/config/index.js | 2 +- v2/src/router/index.js | 7 +++---- v2/src/user/index.js | 2 +- views/v2/user.ejs | 2 +- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index ea793af..5109cf2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ipwhitelist", - "version": "0.5.105", + "version": "0.5.106", "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 6275900..8d36ca1 100644 --- a/v2/src/config/index.js +++ b/v2/src/config/index.js @@ -9,7 +9,7 @@ // ═══════════════════════════════════════════════════════════════════════════════ module.exports = { - version: '0.5.102', + version: '0.5.103', // ── 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 ebef8e6..f278c65 100644 --- a/v2/src/router/index.js +++ b/v2/src/router/index.js @@ -40,12 +40,11 @@ function resolveContext(req, res, next) { req.email = isImpersonated ? u.originalUserEmail : (u.email || ''); req.clientId = isImpersonated ? u.impersonatedCompanyId : (u.activeClientId || u.clientId || ''); req.companyName = u.companyName || req.clientId; - // Админ: пользователь с WZ01112 + включён toggle «Администратор» - // По умолчанию adminMode=true для админов (не надо нажимать toggle) + // Админ: пользователь с WZ01112 — всегда админ const allCids = u.allClientIds || [u.clientId || '']; req.canAdmin = allCids.includes('WZ01112') || u.clientId === 'WZ01112' || !!u.isAdmin; - req.adminMode = u.adminMode !== undefined ? !!u.adminMode : req.canAdmin; - req.isAdmin = req.canAdmin && req.adminMode; + req.adminMode = req.canAdmin; + req.isAdmin = req.canAdmin; req.isImpersonated = isImpersonated; req.impersonatedBy = isImpersonated ? u.email : null; req.allClientIds = allCids; diff --git a/v2/src/user/index.js b/v2/src/user/index.js index fe40122..46f3b86 100644 --- a/v2/src/user/index.js +++ b/v2/src/user/index.js @@ -25,7 +25,7 @@ function createUserRouter() { // ── GET / — список записей + форма ────────────────────────────────── router.get('/', async (req, res) => { try { - const isAdmin = req.isAdmin; + const isAdmin = req.canAdmin; const clId = req.clientId; // ── Переключение компании ────────────────────────────────────── diff --git a/views/v2/user.ejs b/views/v2/user.ejs index 895bdd2..014cb97 100644 --- a/views/v2/user.ejs +++ b/views/v2/user.ejs @@ -116,7 +116,7 @@ IP WhiteList v<%= version %> - <%= user.email %><% if (user.isAdmin) { %> (админ)<% } %> + <%= user.email %> Выйти<% if (user.isImpersonated && user.originalUserEmail) { %> (<%= user.originalUserEmail %>)<% } %>