feat(admin): 슈퍼관리자가 admin 의 개별 프로그램 접근 제어

기존엔 admin 역할이면 모든 모듈을 무조건 전체 ON+잠금이라 슈퍼관리자도
admin 의 특정 프로그램 접근을 끌 수 없었다.

- _normalize_modules: admin 강제 전체 ON 덮어쓰기 제거 → 저장된 칩 상태 존중
- has_module: admin 단축 통과 제거, 슈퍼관리자만 항상 전체. admin 은 칩 따름
- admin.html: admin 칩 잠금 해제(슈퍼관리자만 잠금), 역할→admin 전환 시
  편의상 전체 ON(잠금 아님)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-25 12:15:51 +09:00
parent 4008eee088
commit ef7f76821d
2 changed files with 16 additions and 8 deletions
+10 -4
View File
@@ -152,7 +152,7 @@
{% if key in approver_keys %}is-approver{% endif %}"
data-module="{{ key }}"
aria-pressed="{{ 'true' if u.modules[key] else 'false' }}"
{% if u.is_super_admin or u.role == 'admin' %}data-locked="true"{% endif %}>
{% if u.is_super_admin %}data-locked="true"{% endif %}>
{{ module_labels.get(key, key) }}{% if key in approver_keys %} 승인{% endif %}
</button>
{% endfor %}
@@ -175,8 +175,8 @@
</div>
<p class="erp-section-meta" style="margin-top: var(--sp-16);">
<strong>{{ super_admin_email }}</strong> 은(는) 슈퍼 관리자, 권한 변경/삭제 불가.
admin 역할은 모든 모듈 권한 자동 부여.
<strong>{{ super_admin_email }}</strong> 은(는) 슈퍼 관리자, 권한 변경/삭제 불가(항상 전체 접근).
admin 역할은 기본 전체 ON 이지만 슈퍼관리자가 개별 프로그램 접근을 끌 수 있다.
<code>expense_approver</code> / <code>vacation_approver</code> 는 결재 승인 권한.
</p>
@@ -204,15 +204,21 @@
}
function syncPermChips(tr) {
// 슈퍼관리자만 전체 ON + 잠금. 일반 admin 은 슈퍼관리자가 개별 제어 가능.
// 역할을 admin 으로 바꾸면 편의상 전체 ON(잠금 아님 — 다시 끌 수 있음).
const isSuper = tr.dataset.super === "true";
const adminRole = tr.querySelector("select[data-field='role']").value === "admin";
tr.querySelectorAll(".erp-perm-chip").forEach((chip) => {
if (isSuper || adminRole) {
if (isSuper) {
chip.classList.add("is-on");
chip.setAttribute("aria-pressed", "true");
chip.setAttribute("data-locked", "true");
} else {
chip.removeAttribute("data-locked");
if (adminRole) {
chip.classList.add("is-on");
chip.setAttribute("aria-pressed", "true");
}
}
});
}