Merge feature/permissions-hardening: RBAC hardening + B-lite + P0 UX

Phase A (security): permission registry, audit log on perm/feature changes,

token_version bump on permission changes.

B-lite: requireFeature middleware blocks API on disabled global flags.

P0 UX: search, modified-dot, confirm on critical perms, badge wording.

Conflict resolution: admin.js monolith was restructured into

frontend/js/admin/sections/* by feature/admin-redesign merge. P0 UX

edits (originally in monolith) were manually ported to:

- sections/permissions.js — modDot, confirm gate, filterPermissions

- sections/users.js — 'Инд.' → 'Индивидуально' badge in user-perms modal

admin.html search input + dot CSS auto-merged cleanly.
This commit is contained in:
Maxim Dolgolyov
2026-05-17 14:51:05 +03:00
11 changed files with 407 additions and 252 deletions
+15 -2
View File
@@ -257,6 +257,12 @@
.perm-toggle input:checked ~ .perm-track { background: var(--green, #06d6a0); }
.perm-toggle input:checked ~ .perm-thumb { transform: translateX(20px); }
.perm-toggle input:focus-visible ~ .perm-track { outline: 2px solid var(--violet); }
/* dot shown when a role-level perm differs from its registry default */
.perm-modified-dot {
display: inline-block; width: 8px; height: 8px; border-radius: 50%;
background: var(--amber, #FFB347); flex-shrink: 0;
vertical-align: middle; margin-left: 6px;
}
/* toolbar */
.t-toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 24px; }
@@ -1219,6 +1225,12 @@
<p style="color:var(--muted);font-size:13px;margin:4px 0 0">Настройте, что могут делать учителя и ученики. Администраторы имеют все права всегда.</p>
</div>
<div class="perm-search-wrap" style="margin: 16px 0 20px">
<input type="search" id="perm-search-input" placeholder="Поиск по правам..."
style="width:100%;max-width:420px;padding:9px 14px;border:1.5px solid var(--border);border-radius:10px;font-family:inherit;font-size:0.9rem"
oninput="filterPermissions(this.value)">
</div>
<div class="perm-role-block">
<div class="perm-role-title">
<span class="badge badge-warn" style="font-size:13px;padding:4px 12px">Учитель</span>
@@ -1559,10 +1571,11 @@
<div class="q-modal" id="up-modal" onclick="if(event.target===this)closeUserPermsModal()">
<div class="q-modal-box" style="max-width:520px">
<div class="q-modal-title" id="up-modal-title">Права пользователя</div>
<p style="font-size:12.5px;color:var(--muted);margin:-8px 0 16px">Индивидуальные настройки переопределяют права роли для этого учителя.</p>
<p style="font-size:12.5px;color:var(--muted);margin:-8px 0 16px">Индивидуальные настройки переопределяют права роли для этого пользователя.</p>
<div id="up-modal-list" style="display:flex;flex-direction:column;gap:8px;max-height:420px;overflow-y:auto;padding-right:4px"></div>
<div style="display:flex;justify-content:space-between;align-items:center;margin-top:20px;gap:12px">
<button class="btn-del-q" onclick="doResetAllUserPerms()" id="up-modal-reset-btn">
<button class="btn-del-q" onclick="doResetAllUserPerms()" id="up-modal-reset-btn"
title="Удалить индивидуальные настройки — пользователь будет иметь права как у его роли">
<i data-lucide="rotate-ccw" style="width:13px;height:13px;vertical-align:-2px"></i> Сбросить всё по умолчанию
</button>
<button class="btn-close" onclick="closeUserPermsModal()">Закрыть</button>