v0.5.104: админ видит (личное) у своих компаний в dropdown
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ipwhitelist",
|
"name": "ipwhitelist",
|
||||||
"version": "0.5.103",
|
"version": "0.5.104",
|
||||||
"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.100',
|
version: '0.5.101',
|
||||||
|
|
||||||
// ── 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',
|
||||||
|
|||||||
@@ -51,10 +51,12 @@ function createUserRouter() {
|
|||||||
let companies;
|
let companies;
|
||||||
if (isAdmin) {
|
if (isAdmin) {
|
||||||
const all = await q.getAllCompanies();
|
const all = await q.getAllCompanies();
|
||||||
|
const ownIds = new Set(req.allClientIds || []);
|
||||||
companies = all.map(c => ({
|
companies = all.map(c => ({
|
||||||
client_id: c.client_id,
|
client_id: c.client_id,
|
||||||
name: c.name || c.client_id,
|
name: c.name || c.client_id,
|
||||||
active_count: c.active_count,
|
active_count: c.active_count,
|
||||||
|
isPersonal: ownIds.has(c.client_id),
|
||||||
}));
|
}));
|
||||||
} else {
|
} else {
|
||||||
companies = (req.profiles && req.profiles.length > 0)
|
companies = (req.profiles && req.profiles.length > 0)
|
||||||
|
|||||||
+1
-1
@@ -170,7 +170,7 @@
|
|||||||
<select name="switchTo" onchange="this.form.submit()">
|
<select name="switchTo" onchange="this.form.submit()">
|
||||||
<% companies.forEach(function(c) { %>
|
<% companies.forEach(function(c) { %>
|
||||||
<option value="<%= c.client_id %>" <%= c.client_id === activeClientId ? 'selected' : '' %>>
|
<option value="<%= c.client_id %>" <%= c.client_id === activeClientId ? 'selected' : '' %>>
|
||||||
<%= c.name %> (<%= c.client_id %>)<% if (c.active_count != null) { %> — <%= c.active_count %> зап.<% } %>
|
<%= c.name %> (<%= c.client_id %>)<% if (c.isPersonal) { %> (личное)<% } %><% if (c.active_count != null) { %> — <%= c.active_count %> зап.<% } %>
|
||||||
</option>
|
</option>
|
||||||
<% }) %>
|
<% }) %>
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
Reference in New Issue
Block a user