메뉴 기능 추가 - menu.yml GNB 정의 - 접근 인터셉터/뷰 주입/내부 API 구현

This commit is contained in:
Rinjae
2026-08-05 14:19:33 +09:00
parent 2c63fa1557
commit 5585df9133
20 changed files with 1312 additions and 170 deletions
+5 -20
View File
@@ -23,6 +23,10 @@ server:
spring:
config:
import:
- classpath:menu.yml
- classpath:roles.yml
data:
web:
pageable:
@@ -218,26 +222,7 @@ portal:
view-name: apps/apis/static/tokenApiSpec
bean: apiHandler
portal_security:
ROLE_USER:
- ROLE_INQUIRY
- ROLE_ACCOUNT
ROLE_CORP_USER:
- ROLE_API_KEY_REQUEST
- ROLE_API_KEY_REQUEST_VIEW
- ROLE_INQUIRY
- ROLE_APP
- ROLE_ACCOUNT
ROLE_CORP_MANAGER:
- ROLE_API_KEY_REQUEST
- ROLE_API_KEY_REQUEST_VIEW
- ROLE_WEBHOOK
- ROLE_INQUIRY
- ROLE_APP
- ROLE_ACCOUNT
- ROLE_CORP_API
- ROLE_DASHBOARD
- ROLE_USER_MANAGER
# portal_security 는 roles.yml (portal-roles) 로 이동
page:
home:
name: "Home"
+55
View File
@@ -0,0 +1,55 @@
# ------------------------------------------------------------------------------
# 포탈 GNB 메뉴 정의 (menu.yml)
#
# - 부팅 시 PTL_MENU_ITEM 으로 자동 적재(upsert by id). 동일 id 의 내용이 바뀌면
# 기본값(DFLT_*)이 갱신되고, 관리자가 수정하지 않은 필드만 새 기본값을 따라간다.
# - 배치(위치) 정보는 PTL_MENU_PLACEMENT 가 비어있을 때만 최초 적재된다.
# 이후 배치 관리는 eapim-admin "포탈메뉴관리" 화면에서 수행.
# - id: kebab-case (^[a-z0-9-]+$). 변경 시 새 항목으로 인식되므로 변경 금지.
# - group: true → 상위 그룹(클릭 없음). path 를 주면 그룹도 링크 동작.
# - section: GNB(기본) | MYPAGE(마이페이지 드롭다운)
# - expose-roles / access-roles: 생략=전체 허용, AUTHENTICATED=로그인 사용자,
# 그 외 역할 코드 나열 시 하나라도 보유하면 허용(any-of)
# ------------------------------------------------------------------------------
portal-menu:
items:
- id: service
name: "서비스 소개"
group: true
children:
- { id: service-intro, name: "API 포탈 소개", path: /service/intro }
- { id: service-guide, name: "회원가입 안내", path: /service/guide }
- { id: service-oauth2-guide, name: "OAuth2 개발가이드", path: /service/oauth2-guide }
- { id: service-webhook-dev-guide, name: "웹훅 개발가이드", path: /service/webhook-dev-guide }
- { id: open-api, name: "오픈 API", path: /apis }
- id: support
name: "고객지원"
group: true
children:
- { id: support-notice, name: "공지사항", path: /portalnotice }
- { id: support-faq, name: "FAQ", path: /faq_list }
- { id: support-qna, name: "Q&A", path: /inquiry }
- { id: support-partnership, name: "피드백/개선요청", path: /partnership }
- { id: api-status, name: "API Status", path: /apistatus }
- id: my-page
name: "마이페이지"
group: true
section: MYPAGE
expose-roles: [AUTHENTICATED]
children:
- { id: my-page-users, name: "개발자 관리", path: /users, icon: fa-users,
expose-roles: [ROLE_CORP_MANAGER], access-roles: [ROLE_CORP_MANAGER] }
- { id: my-page-clients, name: "API 신청 관리", path: /clients, icon: fa-key,
expose-roles: [ROLE_APP], access-roles: [ROLE_APP] }
- { id: my-page-webhook, name: "Webhook 관리", path: /webhook, icon: fa-bell,
expose-roles: [ROLE_WEBHOOK], access-roles: [ROLE_WEBHOOK] }
- { id: my-page-statistics, name: "이용 통계", path: /statistics/api, icon: fa-chart-bar,
expose-roles: [ROLE_APP], access-roles: [ROLE_APP] }
- { id: my-page-profile, name: "내 정보 관리", path: /mypage, icon: fa-user-circle,
expose-roles: [AUTHENTICATED], access-roles: [AUTHENTICATED] }
- { id: my-page-password, name: "비밀번호 변경", path: /password/change, icon: fa-lock,
expose-roles: [AUTHENTICATED], access-roles: [AUTHENTICATED] }
+47
View File
@@ -0,0 +1,47 @@
# ------------------------------------------------------------------------------
# 포탈 역할 정의 (roles.yml)
#
# - 기존 application.yml 의 portal.portal_security 를 이동한 파일.
# - 로그인 시 권한 확장(PortalUserAuthService)은 이 파일 바인딩을 직접 사용한다.
# - 부팅 시 PTL_ROLE / PTL_ROLE_AUTHORITY 로 미러 적재되며,
# 해당 테이블은 eapim-admin 메뉴 권한 선택 UI 소스로만 소비된다.
# ------------------------------------------------------------------------------
portal-roles:
roles:
- code: ROLE_USER
name: "개인사용자"
authorities:
- ROLE_INQUIRY
- ROLE_ACCOUNT
- code: ROLE_CORP_USER
name: "법인사용자"
authorities:
- ROLE_API_KEY_REQUEST
- ROLE_API_KEY_REQUEST_VIEW
- ROLE_INQUIRY
- ROLE_APP
- ROLE_ACCOUNT
- code: ROLE_CORP_MANAGER
name: "법인관리자"
authorities:
- ROLE_API_KEY_REQUEST
- ROLE_API_KEY_REQUEST_VIEW
- ROLE_WEBHOOK
- ROLE_INQUIRY
- ROLE_APP
- ROLE_ACCOUNT
- ROLE_CORP_API
- ROLE_DASHBOARD
- ROLE_USER_MANAGER
# PTL_ROLE(AUTHORITY 유형) 한글 라벨 — admin 권한 선택 UI 표기용
authority-names:
ROLE_INQUIRY: "문의 작성"
ROLE_ACCOUNT: "계정 관리"
ROLE_API_KEY_REQUEST: "인증키 신청"
ROLE_API_KEY_REQUEST_VIEW: "인증키 신청 조회"
ROLE_APP: "앱/API 신청 관리"
ROLE_WEBHOOK: "웹훅 관리"
ROLE_CORP_API: "법인 API 조회"
ROLE_DASHBOARD: "대시보드"
ROLE_USER_MANAGER: "개발자 관리"
@@ -27,28 +27,22 @@
</div>
</div>
<!-- 상단 GNB: DB 메뉴(menuView) 기반 렌더 — .nav-menu > li / .sub-menu 구조는 하단 JS 의존 -->
<nav class="header-center">
<ul class="nav-menu">
<li>
<a href="#" class="nav-link">서비스 소개</a>
<ul class="sub-menu">
<li><a th:href="@{/service/intro}">API 포탈 소개</a></li>
<li><a th:href="@{/service/guide}">회원가입 안내</a></li>
<li><a th:href="@{/service/oauth2-guide}">OAuth2 개발가이드</a></li>
<li><a th:href="@{/service/webhook-dev-guide}">웹훅 개발가이드</a></li>
</ul>
<li th:each="menu : ${menuView.gnb}">
<th:block th:if="${!menu.children.isEmpty()}">
<a th:href="${menu.hasPath()} ? @{${menu.path}} : '#'" class="nav-link" th:text="${menu.name}">메뉴</a>
<ul class="sub-menu">
<li th:each="child : ${menu.children}">
<a th:href="@{${child.path}}" th:target="${child.newWindow} ? '_blank' : null"
th:text="${child.name}">하위 메뉴</a>
</li>
</ul>
</th:block>
<a th:if="${menu.children.isEmpty()}" th:href="${menu.hasPath()} ? @{${menu.path}} : '#'"
th:target="${menu.newWindow} ? '_blank' : null" class="nav-link" th:text="${menu.name}">메뉴</a>
</li>
<li><a href="/apis" class="nav-link">오픈 API</a></li>
<li>
<a href="#playground" class="nav-link">고객지원</a>
<ul class="sub-menu">
<li><a th:href="@{/portalnotice}">공지사항</a></li>
<li><a th:href="@{/faq_list}">FAQ</a></li>
<li><a th:href="@{/inquiry}">Q&amp;A</a></li>
<li><a th:href="@{/partnership}">피드백/개선요청</a></li>
</ul>
</li>
<li><a th:href="@{/apistatus}" class="nav-link">API Status</a></li>
</ul>
</nav>
@@ -76,20 +70,18 @@
<span class="divider"></span>
<a th:href="@{/actionLogout.do}" class="header-link">로그아웃</a>
<span class="divider"></span>
<div class="mypage-dropdown">
<button class="header-link mypage-toggle" type="button">마이페이지</button>
<!-- 마이페이지 드롭다운: DB 메뉴(menuView.mypage) 기반, 노출 권한은 서버 필터 적용 -->
<div class="mypage-dropdown" th:if="${menuView.mypage != null}">
<button class="header-link mypage-toggle" type="button"
th:text="${menuView.mypage.name}">마이페이지</button>
<div class="mypage-dropdown-menu">
<ul class="mypage-menu-list">
<li sec:authorize="hasRole('ROLE_CORP_MANAGER')">
<a th:href="@{/users}"><i class="fas fa-users"></i>개발자 관리</a>
<li th:each="child : ${menuView.mypage.children}">
<a th:href="@{${child.path}}" th:target="${child.newWindow} ? '_blank' : null">
<i th:if="${child.icon != null}" th:class="'fas ' + ${child.icon}"></i>
<th:block th:text="${child.name}">메뉴</th:block>
</a>
</li>
<li sec:authorize="hasRole('ROLE_APP')">
<a th:href="@{/clients}"><i class="fas fa-key"></i>API 신청 관리</a>
<a th:href="@{/webhook}" sec:authorize="hasRole('ROLE_WEBHOOK')"><i class="fas fa-bell"></i>Webhook 관리</a>
<a th:href="@{/statistics/api}"><i class="fas fa-chart-bar"></i>이용 통계</a>
</li>
<li><a th:href="@{/mypage}"><i class="fas fa-user-circle"></i>내 정보 관리</a></li>
<li><a th:href="@{/password/change}"><i class="fas fa-lock"></i>비밀번호 변경</a></li>
</ul>
</div>
</div>
@@ -184,72 +176,43 @@
</div>
</div>
<!-- Navigation Menu (Accordion Style) -->
<!-- Navigation Menu (Accordion Style): DB 메뉴(menuView) 기반 렌더 -->
<!-- .drawer-menu-item / .drawer-menu-btn / .drawer-submenu 구조는 하단 JS 의존 -->
<nav class="drawer-nav">
<ul class="drawer-menu-list">
<!-- 서비스 소개 -->
<li class="drawer-menu-item has-submenu">
<button class="drawer-menu-btn" type="button">
<span>서비스 소개</span>
<svg class="accordion-icon" width="14" height="7" viewBox="0 0 14 7" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M1 1L7 6L13 1" stroke="#212529" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
</button>
<ul class="drawer-submenu">
<li><a th:href="@{/service/intro}">API 포탈 소개</a></li>
<li><a th:href="@{/service/guide}">회원가입 안내</a></li>
<li><a th:href="@{/service/oauth2-guide}">OAuth2 개발가이드</a></li>
<li><a th:href="@{/service/webhook-dev-guide}">웹훅 개발가이드</a></li>
</ul>
<li th:each="menu : ${menuView.gnb}" class="drawer-menu-item"
th:classappend="${!menu.children.isEmpty()} ? 'has-submenu' : ''">
<th:block th:if="${!menu.children.isEmpty()}">
<button class="drawer-menu-btn" type="button">
<span th:text="${menu.name}">메뉴</span>
<svg class="accordion-icon" width="14" height="7" viewBox="0 0 14 7" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M1 1L7 6L13 1" stroke="#212529" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
</button>
<ul class="drawer-submenu">
<li th:each="child : ${menu.children}">
<a th:href="@{${child.path}}" th:target="${child.newWindow} ? '_blank' : null"
th:text="${child.name}">하위 메뉴</a>
</li>
</ul>
</th:block>
<a th:if="${menu.children.isEmpty()}" th:href="${menu.hasPath()} ? @{${menu.path}} : '#'"
th:target="${menu.newWindow} ? '_blank' : null" class="drawer-menu-btn" th:text="${menu.name}">메뉴</a>
</li>
<!-- API -->
<li class="drawer-menu-item has-submenu">
<!-- 마이페이지 (노출 권한 서버 필터 — 미노출 시 null) -->
<li class="drawer-menu-item has-submenu" th:if="${menuView.mypage != null}">
<button class="drawer-menu-btn" type="button">
<span>API</span>
<span th:text="${menuView.mypage.name}">마이페이지</span>
<svg class="accordion-icon" width="14" height="7" viewBox="0 0 14 7" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M1 1L7 6L13 1" stroke="#212529" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
</button>
<ul class="drawer-submenu">
<li><a th:href="@{/apis}">API 마켓</a></li>
</ul>
</li>
<!-- 고객지원 -->
<li class="drawer-menu-item has-submenu">
<button class="drawer-menu-btn" type="button">
<span>고객지원</span>
<svg class="accordion-icon" width="14" height="7" viewBox="0 0 14 7" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M1 1L7 6L13 1" stroke="#212529" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
</button>
<ul class="drawer-submenu">
<li><a th:href="@{/portalnotice}">공지사항</a></li>
<li><a th:href="@{/faq_list}">FAQ</a></li>
<li><a th:href="@{/inquiry}">Q&amp;A</a></li>
<li><a th:href="@{/partnership}">사업 제휴 문의</a></li>
</ul>
</li>
<!-- API Status -->
<li class="drawer-menu-item">
<a th:href="@{/apistatus}" class="drawer-menu-btn">API Status</a>
</li>
<!-- 마이페이지 (Authenticated Only) -->
<li class="drawer-menu-item has-submenu" sec:authorize="isAuthenticated()">
<button class="drawer-menu-btn" type="button">
<span>마이페이지</span>
<svg class="accordion-icon" width="14" height="7" viewBox="0 0 14 7" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M1 1L7 6L13 1" stroke="#212529" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
</button>
<ul class="drawer-submenu">
<li sec:authorize="hasRole('ROLE_CORP_MANAGER')"><a th:href="@{/users}">개발자 관리</a></li>
<li sec:authorize="hasRole('ROLE_APP')"><a th:href="@{/clients}">API 신청 관리</a></li>
<li sec:authorize="hasRole('ROLE_WEBHOOK')"><a th:href="@{/webhook}">Webhook 관리</a></li>
<li sec:authorize="hasRole('ROLE_APP')"><a th:href="@{/statistics/api}">이용 통계</a></li>
<li><a th:href="@{/mypage}">내 정보 관리</a></li>
<li><a th:href="@{/password/change}">비밀번호 변경</a></li>
<li th:each="child : ${menuView.mypage.children}">
<a th:href="@{${child.path}}" th:target="${child.newWindow} ? '_blank' : null"
th:text="${child.name}">하위 메뉴</a>
</li>
</ul>
</li>
</ul>
@@ -2,41 +2,13 @@
<html xmlns:th="http://www.thymeleaf.org">
<body>
<!-- Service Left Sidebar Fragment -->
<aside class="service-sidebar" th:fragment="sidebar(activeMenu)">
<nav class="service-nav">
<!-- 서비스 소개 그룹 (Service) -->
<th:block
th:if="${activeMenu == 'intro' or activeMenu == 'guide' or activeMenu == 'oauth2' or activeMenu == 'webhookGuide'}">
<a th:href="@{/service/intro}" th:classappend="${activeMenu == 'intro'} ? 'service-nav__item--active' : ''"
class="service-nav__item">API 포탈 소개</a>
<a th:href="@{/service/guide}" th:classappend="${activeMenu == 'guide'} ? 'service-nav__item--active' : ''"
class="service-nav__item">회원가입 안내</a>
<a th:href="@{/service/oauth2-guide}"
th:classappend="${activeMenu == 'oauth2'} ? 'service-nav__item--active' : ''"
class="service-nav__item">OAuth2 개발가이드</a>
<a th:href="@{/service/webhook-dev-guide}"
th:classappend="${activeMenu == 'webhookGuide'} ? 'service-nav__item--active' : ''"
class="service-nav__item">웹훅 개발가이드</a>
</th:block>
<!-- 고객지원 그룹 (Customer Support) -->
<th:block
th:if="${activeMenu == 'notice' or activeMenu == 'faq' or activeMenu == 'qna' or activeMenu == 'feedback'}">
<a th:href="@{/portalnotice}" th:classappend="${activeMenu == 'notice'} ? 'service-nav__item--active' : ''"
class="service-nav__item">공지사항</a>
<a th:href="@{/faq_list}" th:classappend="${activeMenu == 'faq'} ? 'service-nav__item--active' : ''"
class="service-nav__item">FAQ</a>
<a th:href="@{/inquiry}" th:classappend="${activeMenu == 'qna'} ? 'service-nav__item--active' : ''"
class="service-nav__item">Q&A</a>
<a th:href="@{/partnership}" th:classappend="${activeMenu == 'feedback'} ? 'service-nav__item--active' : ''"
class="service-nav__item">피드백/개선요청</a>
</th:block>
<!-- 마이페이지 그룹 (My Page) -->
<th:block
th:if="${activeMenu == 'users' or activeMenu == 'apiKey' or activeMenu == 'statistics' or activeMenu == 'webhook' or activeMenu == 'profile' or activeMenu == 'password'}">
<!-- Profile Section -->
<!-- Service Left Sidebar Fragment: DB 메뉴(menuView) 기반 렌더.
activeMenu 파라미터는 기존 호출부 호환용 레거시 키(MenuView.LEGACY_ACTIVE_KEYS 브리지). -->
<aside class="service-sidebar" th:fragment="sidebar(activeMenu)"
th:with="grp=${menuView.activeGroup(activeMenu)}">
<nav class="service-nav" th:if="${grp != null}">
<!-- 마이페이지 그룹 프로필 -->
<th:block th:if="${grp.section == 'MYPAGE'}">
<div class="service-sidebar__profile">
<div class="avatar">
<svg viewBox="0 0 24 24" fill="currentColor">
@@ -48,29 +20,14 @@
</div>
<div class="service-sidebar__divider"></div>
<a th:href="@{/users}" th:classappend="${activeMenu == 'users'} ? 'service-nav__item--active' : ''"
class="service-nav__item" sec:authorize="hasRole('ROLE_CORP_MANAGER')">개발자 관리</a>
<a th:href="@{/clients}" th:classappend="${activeMenu == 'apiKey'} ? 'service-nav__item--active' : ''"
class="service-nav__item" sec:authorize="hasRole('ROLE_APP')">API 신청 관리</a>
<a th:href="@{/webhook}" th:classappend="${activeMenu == 'webhook'} ? 'service-nav__item--active' : ''"
class="service-nav__item" sec:authorize="hasRole('ROLE_WEBHOOK')">Webhook 관리</a>
<a th:href="@{/statistics/api}"
th:classappend="${activeMenu == 'statistics'} ? 'service-nav__item--active' : ''"
class="service-nav__item" sec:authorize="hasRole('ROLE_APP')">이용통계</a>
<a th:href="@{/mypage}" th:classappend="${activeMenu == 'profile'} ? 'service-nav__item--active' : ''"
class="service-nav__item">내정보 관리</a>
<a th:href="@{/password/change}"
th:classappend="${activeMenu == 'password'} ? 'service-nav__item--active' : ''"
class="service-nav__item">비밀번호 변경</a>
</th:block>
<a th:each="child : ${grp.children}" th:href="@{${child.path}}"
th:target="${child.newWindow} ? '_blank' : null"
th:classappend="${menuView.isActive(child, activeMenu)} ? 'service-nav__item--active' : ''"
class="service-nav__item" th:text="${child.name}">메뉴</a>
</nav>
</aside>
</body>
</html>
</html>