v0.5.103: WZ01112 админ по умолчанию, adminMode auto-on
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ipwhitelist",
|
"name": "ipwhitelist",
|
||||||
"version": "0.5.102",
|
"version": "0.5.103",
|
||||||
"description": "IP WhiteList microservice for cloud provider",
|
"description": "IP WhiteList microservice for cloud provider",
|
||||||
"main": "server.js",
|
"main": "server.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
// ═══════════════════════════════════════════════════════════════════════════════
|
// ═══════════════════════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
version: '0.5.99',
|
version: '0.5.100',
|
||||||
|
|
||||||
// ── IAM ──────────────────────────────────────────────────────────────────
|
// ── IAM ──────────────────────────────────────────────────────────────────
|
||||||
iamUrl: process.env.V2_IAM_URL || 'https://auth-api.ngcloud.ru/api/v1/auth/user',
|
iamUrl: process.env.V2_IAM_URL || 'https://auth-api.ngcloud.ru/api/v1/auth/user',
|
||||||
|
|||||||
@@ -41,9 +41,10 @@ function resolveContext(req, res, next) {
|
|||||||
req.clientId = isImpersonated ? u.impersonatedCompanyId : (u.activeClientId || u.clientId || '');
|
req.clientId = isImpersonated ? u.impersonatedCompanyId : (u.activeClientId || u.clientId || '');
|
||||||
req.companyName = u.companyName || req.clientId;
|
req.companyName = u.companyName || req.clientId;
|
||||||
// Админ: пользователь с WZ01112 + включён toggle «Администратор»
|
// Админ: пользователь с WZ01112 + включён toggle «Администратор»
|
||||||
|
// По умолчанию adminMode=true для админов (не надо нажимать toggle)
|
||||||
const allCids = u.allClientIds || [u.clientId || ''];
|
const allCids = u.allClientIds || [u.clientId || ''];
|
||||||
req.canAdmin = allCids.includes('WZ01112') || u.clientId === 'WZ01112' || !!u.isAdmin;
|
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.isAdmin = req.canAdmin && req.adminMode;
|
||||||
req.isImpersonated = isImpersonated;
|
req.isImpersonated = isImpersonated;
|
||||||
req.impersonatedBy = isImpersonated ? u.email : null;
|
req.impersonatedBy = isImpersonated ? u.email : null;
|
||||||
|
|||||||
Reference in New Issue
Block a user