feat: IAM impersonation support — isImpersonated flag + banner

- src/auth.js: fetchIamUser extract isImpersonated from response
- src/routes/oidc.js: save isImpersonated to session
- ui/index.js: isImpersonated in req.user
- ui/routes/entries.js: pass isImpersonated to render
- views/index.ejs: banner 'Режим имперсонации'
- docs/PLAN-impersonation.md: план дальнейших шагов (двойной аудит)
This commit is contained in:
2026-06-11 15:34:19 +04:00
parent 7b3dd8b4b3
commit a2cfd2c10f
6 changed files with 13 additions and 1 deletions
+6
View File
@@ -182,6 +182,12 @@
<% if (success) { %><div class="alert alert-ok"><%= success %></div><% } %>
<% if (error) { %><div class="alert alert-err"><%= error %></div><% } %>
<% if (typeof isImpersonated !== 'undefined' && isImpersonated) { %>
<div style="background:#fef3c7;border:1px solid #d97706;color:#92400e;padding:.5rem 1rem;border-radius:8px;margin-bottom:.5rem;font-size:.85rem;">
⚠️ Режим имперсонации — данные сохраняются от имени <strong><%= user.clientId %></strong>
</div>
<% } %>
<%
// Для admin: selectedCompany — выбранная компания (объект из getAllCompanies).
// Для обычного пользователя: selectedCompany — их компания (из getOrCreateCompany).