feat: IAM API интеграция + обновление ТЗ + тесты

- src/auth.js: fetchIamUser(), switchProfile(), userFromPayload(iamData)
- src/config.js: IAM_API_URL из env
- src/routes/oidc.js: обогащение сессии через IAM (с fallback на JWT)
- ui/routes/auth.js: обогащение при токен-логине
- ui/routes/entries.js: switchTo через POST /switch-profile
- src/api/routes/entries.js: resolveCompany через profiles[]
- views/index.ejs: переключатель компаний с названиями из profiles
- .env.example: IAM_API_URL
- docs: обновлены ТЗ-реализация.md, ТЗ-плюс.md, добавлен iam-integration.md
- tests: api-crud.sh (14 тестов CRUD + валидации)
- .gitignore: исключены .env.test, DEPLOY-TESTING.md
This commit is contained in:
2026-06-04 13:53:44 +03:00
parent 878e46287b
commit a8a07fe019
15 changed files with 1404 additions and 164 deletions
+13 -5
View File
@@ -219,11 +219,19 @@
<span style="font-size:.85rem;color:var(--muted);font-weight:500;">Компания:</span>
<select id="company-switch"
style="padding:.4rem .75rem;border:1px solid var(--border);border-radius:6px;font-size:.85rem;background:#fff;">
<% allClientIds.forEach(id => { %>
<option value="<%= id %>" <%= id === activeClientId ? 'selected' : '' %>>
<%= id %>
</option>
<% }) %>
<% if (typeof profiles !== 'undefined' && profiles.length) { %>
<% profiles.forEach(p => { %>
<option value="<%= p.client_id %>" <%= p.is_active_profile ? 'selected' : '' %>>
<%= p.company_name %> (<%= p.client_id %>)
</option>
<% }) %>
<% } else { %>
<% allClientIds.forEach(id => { %>
<option value="<%= id %>" <%= id === activeClientId ? 'selected' : '' %>>
<%= id %>
</option>
<% }) %>
<% } %>
</select>
<span style="margin-left:auto;font-size:.8rem;color:var(--muted);">
Компаний: <strong><%= allClientIds.length %></strong>