[Developer] #424 add user and permission management

Refs #424
This commit is contained in:
devmrko
2026-06-23 11:28:59 +09:00
parent c55e7add27
commit 16718f0277
23 changed files with 708 additions and 3 deletions

View File

@@ -15,7 +15,9 @@
<div class="container">
<a class="navbar-brand" href="/">VPD Backoffice</a>
<div class="navbar-nav">
<a class="nav-link" href="/users">사용자</a>
<a class="nav-link" href="/permissions">권한</a>
<a class="nav-link" href="/objects">테이블/뷰</a>
<a class="nav-link" href="/tokens">토큰</a>
<a class="nav-link" href="/probe">ORDS 검증</a>
</div>

View File

@@ -0,0 +1,78 @@
<!doctype html>
<html lang="ko" xmlns:th="http://www.thymeleaf.org">
<head th:replace="~{fragments/layout :: head('테이블/뷰 관리')}"></head>
<body>
<nav th:replace="~{fragments/layout :: nav}"></nav>
<main class="container py-4">
<div class="page-title">
<h1>테이블/뷰 관리</h1>
<p>권한에 사용할 보호 객체와 ORDS 경로를 등록합니다.</p>
</div>
<div class="alert alert-success" th:if="${message}" th:text="${message}"></div>
<section class="content-band">
<h2>테이블/뷰 추가</h2>
<form method="post" action="/objects" class="form-grid">
<input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}">
<label>
Owner
<input class="form-control" name="owner" value="ADMIN" required>
</label>
<label>
Object
<input class="form-control" name="objectName" placeholder="CB_V_SEARCH_DOCUMENTS" required>
</label>
<label>
ORDS Path
<input class="form-control" name="ordsPath" placeholder="cb-agent-security/vpd/documents" required>
</label>
<label>
컬럼
<input class="form-control" name="columns" placeholder="DOC_ID,TITLE,CONTENTS">
</label>
<label>
민감 컬럼
<input class="form-control" name="sensitiveColumns" placeholder="CONTENTS">
</label>
<button class="btn btn-primary" type="submit">추가</button>
</form>
</section>
<section class="content-band">
<h2>등록된 테이블/뷰</h2>
<div class="table-responsive">
<table class="table table-sm align-middle">
<thead>
<tr>
<th>ID</th>
<th>Owner</th>
<th>Object</th>
<th>ORDS Path</th>
<th></th>
</tr>
</thead>
<tbody>
<tr th:each="object : ${objects}">
<td th:text="${object.objectId()}">1</td>
<td th:text="${object.owner()}">ADMIN</td>
<td th:text="${object.objectName()}">CB_V_SEARCH_DOCUMENTS</td>
<td><code th:text="${object.ordsPath()}">path</code></td>
<td>
<form method="post" action="/objects/disable" class="inline-form">
<input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}">
<input type="hidden" name="objectId" th:value="${object.objectId()}">
<button class="btn btn-sm btn-outline-danger" type="submit">비활성화</button>
</form>
</td>
</tr>
<tr th:if="${#lists.isEmpty(objects)}">
<td colspan="5" class="text-muted">등록된 테이블/뷰가 없습니다.</td>
</tr>
</tbody>
</table>
</div>
</section>
</main>
</body>
</html>

View File

@@ -12,6 +12,7 @@
<div class="alert alert-success" th:if="${message}" th:text="${message}"></div>
<section class="content-band">
<h2>권한 추가</h2>
<form method="post" action="/permissions" class="form-grid">
<input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}">
<label>
@@ -42,6 +43,43 @@
<button class="btn btn-primary" type="submit">저장</button>
</form>
</section>
<section class="content-band">
<h2>권한 목록</h2>
<div class="table-responsive">
<table class="table table-sm align-middle">
<thead>
<tr>
<th>ID</th>
<th>역할</th>
<th>테이블/뷰</th>
<th>Action</th>
<th>행 규칙</th>
<th></th>
</tr>
</thead>
<tbody>
<tr th:each="permission : ${permissions}">
<td th:text="${permission.permissionId()}">100</td>
<td th:text="${permission.roleName()}">HR_DEPT_ROLE</td>
<td th:text="${permission.objectName()}">CB_V_SEARCH_DOCUMENTS</td>
<td th:text="${permission.action()}">SELECT</td>
<td th:text="${permission.rules()} ?: '-'">ALL</td>
<td>
<form method="post" action="/permissions/delete" class="inline-form">
<input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}">
<input type="hidden" name="permissionId" th:value="${permission.permissionId()}">
<button class="btn btn-sm btn-outline-danger" type="submit">삭제</button>
</form>
</td>
</tr>
<tr th:if="${#lists.isEmpty(permissions)}">
<td colspan="6" class="text-muted">등록된 권한이 없습니다.</td>
</tr>
</tbody>
</table>
</div>
</section>
</main>
</body>
</html>

View File

@@ -0,0 +1,131 @@
<!doctype html>
<html lang="ko" xmlns:th="http://www.thymeleaf.org">
<head th:replace="~{fragments/layout :: head('사용자 관리')}"></head>
<body>
<nav th:replace="~{fragments/layout :: nav}"></nav>
<main class="container py-4">
<div class="page-title">
<h1>사용자 관리</h1>
<p>Bearer Token과 권한 매핑에 사용할 내부 사용자를 관리합니다.</p>
</div>
<div class="alert alert-success" th:if="${message}" th:text="${message}"></div>
<section class="content-band">
<h2>사용자 추가</h2>
<form method="post" action="/users" class="form-grid">
<input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}">
<label>
사용자명
<input class="form-control" name="username" required>
</label>
<label>
사번
<input class="form-control" name="empNo" required>
</label>
<label>
부서코드
<input class="form-control" name="deptCode" required>
</label>
<label class="form-check form-switch switch-field">
<input class="form-check-input" name="canReadContents" type="checkbox" value="true">
<span class="form-check-label">민감 컬럼 표시</span>
</label>
<button class="btn btn-primary" type="submit">추가</button>
</form>
</section>
<section class="content-band">
<h2>사용자 목록</h2>
<div class="table-responsive">
<table class="table table-sm align-middle">
<thead>
<tr>
<th>ID</th>
<th>사용자명</th>
<th>사번</th>
<th>부서</th>
<th>민감 컬럼</th>
<th>상태</th>
<th></th>
</tr>
</thead>
<tbody>
<tr th:each="user : ${users}">
<td th:text="${user.userId()}">1</td>
<td th:text="${user.username()}">agent_hr</td>
<td th:text="${user.empNo()}">E10234</td>
<td th:text="${user.deptCode()}">HR</td>
<td><span class="badge" th:classappend="${user.canReadContents() == 'Y'} ? ' text-bg-success' : ' text-bg-secondary'" th:text="${user.canReadContents()}">N</span></td>
<td><span class="badge" th:classappend="${user.active()} ? ' text-bg-success' : ' text-bg-secondary'" th:text="${user.activeYn()}">Y</span></td>
<td>
<form method="post" action="/users/active" class="inline-form">
<input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}">
<input type="hidden" name="userId" th:value="${user.userId()}">
<input type="hidden" name="active" th:value="${!user.active()}">
<button class="btn btn-sm btn-outline-secondary" type="submit" th:text="${user.active()} ? '비활성화' : '활성화'">변경</button>
</form>
</td>
</tr>
<tr th:if="${#lists.isEmpty(users)}">
<td colspan="7" class="text-muted">등록된 사용자가 없습니다.</td>
</tr>
</tbody>
</table>
</div>
</section>
<section class="content-band">
<h2>역할 부여</h2>
<form method="post" action="/users/roles" class="form-grid">
<input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}">
<label>
사용자
<select class="form-select" name="userId" required>
<option th:each="user : ${users}" th:value="${user.userId()}" th:text="${user.username()}"></option>
</select>
</label>
<label>
역할
<select class="form-select" name="roleId" required>
<option th:each="role : ${roles}" th:value="${role.roleId()}" th:text="${role.roleName()}"></option>
</select>
</label>
<button class="btn btn-primary" type="submit">부여</button>
</form>
</section>
<section class="content-band">
<h2>사용자 역할 목록</h2>
<div class="table-responsive">
<table class="table table-sm align-middle">
<thead>
<tr>
<th>사용자</th>
<th>역할</th>
<th></th>
</tr>
</thead>
<tbody>
<tr th:each="mapping : ${userRoles}">
<td th:text="${mapping.username()}">agent_hr</td>
<td th:text="${mapping.roleName()}">HR_DEPT_ROLE</td>
<td>
<form method="post" action="/users/roles/delete" class="inline-form">
<input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}">
<input type="hidden" name="userId" th:value="${mapping.userId()}">
<input type="hidden" name="roleId" th:value="${mapping.roleId()}">
<button class="btn btn-sm btn-outline-danger" type="submit">해제</button>
</form>
</td>
</tr>
<tr th:if="${#lists.isEmpty(userRoles)}">
<td colspan="3" class="text-muted">부여된 역할이 없습니다.</td>
</tr>
</tbody>
</table>
</div>
</section>
</main>
</body>
</html>