From 3f870b247d12b4aa09b02de20e5746e64a09a5f4 Mon Sep 17 00:00:00 2001 From: Hyungi Ahn Date: Wed, 1 Apr 2026 14:14:53 +0900 Subject: [PATCH] =?UTF-8?q?fix(nav):=20=EC=82=AC=EC=9D=B4=EB=93=9C?= =?UTF-8?q?=EB=B0=94=20=EB=A9=94=EB=89=B4=EB=A5=BC=20DB=20=EA=B6=8C?= =?UTF-8?q?=ED=95=9C(accessibleKeys)=20=EA=B8=B0=EB=B0=98=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20=ED=95=84=ED=84=B0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 기존: non-admin 페이지는 무조건 표시 (publicPageKeys 개념) 변경: accessibleKeys에 포함된 페이지만 표시 (대시보드 그리드와 동일 기준) - publicPageKeys 로직 제거, accessibleKeys 단일 기준 통합 - external 링크(부적합, 휴가 신청 등)는 항상 표시 - dashboard, profile.* 페이지는 전체 공개 유지 - tkfb-core.js 캐시 버스팅 v=2026040103 Co-Authored-By: Claude Opus 4.6 (1M context) --- .../web/pages/admin/attendance-report.html | 2 +- .../web/pages/admin/equipment-detail.html | 2 +- system1-factory/web/pages/admin/equipments.html | 2 +- .../web/pages/admin/repair-management.html | 2 +- .../web/pages/attendance/annual-overview.html | 2 +- .../web/pages/attendance/checkin.html | 2 +- system1-factory/web/pages/attendance/daily.html | 2 +- .../web/pages/attendance/monthly-comparison.html | 2 +- .../web/pages/attendance/monthly.html | 2 +- .../web/pages/attendance/my-monthly-confirm.html | 2 +- .../web/pages/attendance/my-vacation-info.html | 2 +- .../pages/attendance/vacation-allocation.html | 2 +- .../web/pages/attendance/vacation-approval.html | 2 +- .../web/pages/attendance/vacation-input.html | 2 +- .../pages/attendance/vacation-management.html | 2 +- .../web/pages/attendance/vacation-request.html | 2 +- .../web/pages/attendance/work-status.html | 2 +- system1-factory/web/pages/dashboard-new.html | 2 +- system1-factory/web/pages/dashboard.html | 2 +- .../web/pages/inspection/daily-patrol.html | 2 +- .../web/pages/inspection/zone-detail.html | 2 +- system1-factory/web/pages/profile/info.html | 2 +- system1-factory/web/pages/profile/password.html | 2 +- system1-factory/web/pages/work/analysis.html | 2 +- system1-factory/web/pages/work/daily-status.html | 2 +- .../web/pages/work/meeting-detail.html | 2 +- system1-factory/web/pages/work/meetings.html | 2 +- system1-factory/web/pages/work/proxy-input.html | 2 +- .../web/pages/work/report-create-mobile.html | 2 +- .../web/pages/work/report-create.html | 2 +- system1-factory/web/pages/work/schedule.html | 2 +- system1-factory/web/pages/work/tbm-create.html | 2 +- system1-factory/web/pages/work/tbm-mobile.html | 2 +- system1-factory/web/pages/work/tbm.html | 2 +- system1-factory/web/static/js/tkfb-core.js | 16 ++++++---------- 35 files changed, 40 insertions(+), 44 deletions(-) diff --git a/system1-factory/web/pages/admin/attendance-report.html b/system1-factory/web/pages/admin/attendance-report.html index 0f89ea6..4556ef4 100644 --- a/system1-factory/web/pages/admin/attendance-report.html +++ b/system1-factory/web/pages/admin/attendance-report.html @@ -190,7 +190,7 @@ - + + + + + + + + diff --git a/system1-factory/web/pages/attendance/monthly.html b/system1-factory/web/pages/attendance/monthly.html index eb846de..4cbd1c6 100644 --- a/system1-factory/web/pages/attendance/monthly.html +++ b/system1-factory/web/pages/attendance/monthly.html @@ -489,7 +489,7 @@ - + + diff --git a/system1-factory/web/pages/attendance/my-vacation-info.html b/system1-factory/web/pages/attendance/my-vacation-info.html index d7fc71d..dd20cc8 100644 --- a/system1-factory/web/pages/attendance/my-vacation-info.html +++ b/system1-factory/web/pages/attendance/my-vacation-info.html @@ -267,7 +267,7 @@ - + + diff --git a/system1-factory/web/pages/attendance/vacation-approval.html b/system1-factory/web/pages/attendance/vacation-approval.html index adbd29d..4431d3b 100644 --- a/system1-factory/web/pages/attendance/vacation-approval.html +++ b/system1-factory/web/pages/attendance/vacation-approval.html @@ -130,7 +130,7 @@ - + diff --git a/system1-factory/web/pages/attendance/vacation-input.html b/system1-factory/web/pages/attendance/vacation-input.html index 1f7bceb..c03b1fd 100644 --- a/system1-factory/web/pages/attendance/vacation-input.html +++ b/system1-factory/web/pages/attendance/vacation-input.html @@ -123,7 +123,7 @@ - + diff --git a/system1-factory/web/pages/attendance/vacation-management.html b/system1-factory/web/pages/attendance/vacation-management.html index 27f32d5..1dfe3a7 100644 --- a/system1-factory/web/pages/attendance/vacation-management.html +++ b/system1-factory/web/pages/attendance/vacation-management.html @@ -215,7 +215,7 @@ - + diff --git a/system1-factory/web/pages/attendance/vacation-request.html b/system1-factory/web/pages/attendance/vacation-request.html index 4df6657..b89ad43 100644 --- a/system1-factory/web/pages/attendance/vacation-request.html +++ b/system1-factory/web/pages/attendance/vacation-request.html @@ -117,7 +117,7 @@ - + diff --git a/system1-factory/web/pages/attendance/work-status.html b/system1-factory/web/pages/attendance/work-status.html index 3ddd9f2..e03b96e 100644 --- a/system1-factory/web/pages/attendance/work-status.html +++ b/system1-factory/web/pages/attendance/work-status.html @@ -286,7 +286,7 @@ - + + diff --git a/system1-factory/web/pages/dashboard.html b/system1-factory/web/pages/dashboard.html index 142951c..16b6ad0 100644 --- a/system1-factory/web/pages/dashboard.html +++ b/system1-factory/web/pages/dashboard.html @@ -324,7 +324,7 @@ - + diff --git a/system1-factory/web/pages/inspection/daily-patrol.html b/system1-factory/web/pages/inspection/daily-patrol.html index ae1c61c..9356357 100644 --- a/system1-factory/web/pages/inspection/daily-patrol.html +++ b/system1-factory/web/pages/inspection/daily-patrol.html @@ -209,7 +209,7 @@ }, 50); })(); - + diff --git a/system1-factory/web/pages/inspection/zone-detail.html b/system1-factory/web/pages/inspection/zone-detail.html index 183d172..016e97c 100644 --- a/system1-factory/web/pages/inspection/zone-detail.html +++ b/system1-factory/web/pages/inspection/zone-detail.html @@ -304,7 +304,7 @@ }, 50); })(); - + diff --git a/system1-factory/web/pages/profile/info.html b/system1-factory/web/pages/profile/info.html index b49b9bc..1ddb057 100644 --- a/system1-factory/web/pages/profile/info.html +++ b/system1-factory/web/pages/profile/info.html @@ -320,7 +320,7 @@ - + diff --git a/system1-factory/web/pages/profile/password.html b/system1-factory/web/pages/profile/password.html index ce20e76..f0a171d 100644 --- a/system1-factory/web/pages/profile/password.html +++ b/system1-factory/web/pages/profile/password.html @@ -390,7 +390,7 @@ - + diff --git a/system1-factory/web/pages/work/analysis.html b/system1-factory/web/pages/work/analysis.html index 5316a9a..359d789 100644 --- a/system1-factory/web/pages/work/analysis.html +++ b/system1-factory/web/pages/work/analysis.html @@ -277,7 +277,7 @@ - + diff --git a/system1-factory/web/pages/work/daily-status.html b/system1-factory/web/pages/work/daily-status.html index 80ba487..939d1ab 100644 --- a/system1-factory/web/pages/work/daily-status.html +++ b/system1-factory/web/pages/work/daily-status.html @@ -163,7 +163,7 @@ - + diff --git a/system1-factory/web/pages/work/meeting-detail.html b/system1-factory/web/pages/work/meeting-detail.html index 51d0a35..8ec105d 100644 --- a/system1-factory/web/pages/work/meeting-detail.html +++ b/system1-factory/web/pages/work/meeting-detail.html @@ -193,7 +193,7 @@ - + diff --git a/system1-factory/web/pages/work/meetings.html b/system1-factory/web/pages/work/meetings.html index c182404..77ad1d3 100644 --- a/system1-factory/web/pages/work/meetings.html +++ b/system1-factory/web/pages/work/meetings.html @@ -80,7 +80,7 @@ - + diff --git a/system1-factory/web/pages/work/proxy-input.html b/system1-factory/web/pages/work/proxy-input.html index 2dbf9c1..9ef06f1 100644 --- a/system1-factory/web/pages/work/proxy-input.html +++ b/system1-factory/web/pages/work/proxy-input.html @@ -114,7 +114,7 @@ - + diff --git a/system1-factory/web/pages/work/report-create-mobile.html b/system1-factory/web/pages/work/report-create-mobile.html index dfabe3b..9738ca2 100644 --- a/system1-factory/web/pages/work/report-create-mobile.html +++ b/system1-factory/web/pages/work/report-create-mobile.html @@ -190,7 +190,7 @@ - + diff --git a/system1-factory/web/pages/work/report-create.html b/system1-factory/web/pages/work/report-create.html index 4922a21..40baf0f 100644 --- a/system1-factory/web/pages/work/report-create.html +++ b/system1-factory/web/pages/work/report-create.html @@ -149,7 +149,7 @@ - + diff --git a/system1-factory/web/pages/work/schedule.html b/system1-factory/web/pages/work/schedule.html index 7d4da71..2a64309 100644 --- a/system1-factory/web/pages/work/schedule.html +++ b/system1-factory/web/pages/work/schedule.html @@ -347,7 +347,7 @@ - + + diff --git a/system1-factory/web/pages/work/tbm-mobile.html b/system1-factory/web/pages/work/tbm-mobile.html index 2e8825b..4c49bf9 100644 --- a/system1-factory/web/pages/work/tbm-mobile.html +++ b/system1-factory/web/pages/work/tbm-mobile.html @@ -264,7 +264,7 @@ - + diff --git a/system1-factory/web/pages/work/tbm.html b/system1-factory/web/pages/work/tbm.html index d22cf62..d9f0037 100644 --- a/system1-factory/web/pages/work/tbm.html +++ b/system1-factory/web/pages/work/tbm.html @@ -573,7 +573,7 @@
- + diff --git a/system1-factory/web/static/js/tkfb-core.js b/system1-factory/web/static/js/tkfb-core.js index bd41a05..c41b82e 100644 --- a/system1-factory/web/static/js/tkfb-core.js +++ b/system1-factory/web/static/js/tkfb-core.js @@ -202,8 +202,7 @@ function renderNavbar(accessibleKeys) { const visibleItems = entry.items.filter(item => { if (item.admin && !isAdmin) return false; if (isAdmin) return true; - // NAV_MENU에 admin 아닌 항목은 공개 (publicPageKeys 대응) - if (!item.admin) return true; + if (item.external) return true; return accessibleKeys.includes(item.key); }); @@ -283,16 +282,13 @@ async function initAuth() { let accessibleKeys = []; if (!isAdmin) { accessibleKeys = await _fetchPageAccess(currentUser.id); - // NAV_MENU에서 admin/restricted가 아닌 페이지는 모든 인증 사용자에게 공개 - const publicPageKeys = NAV_MENU.flatMap(entry => { - if (!entry.items) return entry.key ? [entry.key] : []; - if (entry.admin) return []; - return entry.items.filter(item => !item.admin && !item.restricted).map(item => item.key); - }); - // 현재 페이지 접근 권한 확인 + if (accessibleKeys.length === 0) { + console.warn('[PageAccess] 접근 가능 페이지가 없거나 권한 조회 실패'); + } + // 현재 페이지 접근 권한 확인 (dashboard, profile은 전체 공개) const pageKey = _getCurrentPageKey(); if (pageKey && pageKey !== 'dashboard' && !pageKey.startsWith('profile.')) { - if (!publicPageKeys.includes(pageKey) && !accessibleKeys.includes(pageKey)) { + if (!accessibleKeys.includes(pageKey)) { alert('이 페이지에 접근할 권한이 없습니다.'); location.href = '/pages/dashboard-new.html'; return false;