@@ -18,6 +18,14 @@
|
||||
WHERE k.key_id = #{keyId}
|
||||
</select>
|
||||
|
||||
<select id="findByHash" resultType="com.cloudhandson.vpdbackoffice.domain.token.BearerTokenRecord">
|
||||
SELECT k.key_id, k.user_id, u.user_name AS username, k.key_prefix, k.key_hash,
|
||||
k.expires_at, k.revoked_at, k.description
|
||||
FROM cb_agent_bearer_key k
|
||||
JOIN cb_app_user u ON u.user_id = k.user_id
|
||||
WHERE k.key_hash = #{keyHash,jdbcType=VARCHAR}
|
||||
</select>
|
||||
|
||||
<select id="nextKeyId" resultType="long">
|
||||
SELECT cb_agent_bearer_key_seq.NEXTVAL FROM dual
|
||||
</select>
|
||||
|
||||
@@ -14,6 +14,20 @@
|
||||
WHERE role_id = #{roleId}
|
||||
</select>
|
||||
|
||||
<select id="nextRoleId" resultType="long">
|
||||
SELECT NVL(MAX(role_id), 0) + 1 FROM cb_app_role
|
||||
</select>
|
||||
|
||||
<insert id="insertRole">
|
||||
INSERT INTO cb_app_role (role_id, role_name)
|
||||
VALUES (#{roleId,jdbcType=NUMERIC}, UPPER(#{roleName,jdbcType=VARCHAR}))
|
||||
</insert>
|
||||
|
||||
<delete id="deleteRole">
|
||||
DELETE FROM cb_app_role
|
||||
WHERE role_id = #{roleId,jdbcType=NUMERIC}
|
||||
</delete>
|
||||
|
||||
<select id="findPermissionViews" resultType="com.cloudhandson.vpdbackoffice.domain.permission.PermissionView">
|
||||
SELECT p.perm_id AS permission_id,
|
||||
r.role_id,
|
||||
|
||||
@@ -15,6 +15,31 @@
|
||||
WHERE object_id = #{objectId}
|
||||
</select>
|
||||
|
||||
<select id="findByOwnerAndName" resultType="com.cloudhandson.vpdbackoffice.domain.protectedobject.ProtectedObject">
|
||||
SELECT object_id, owner, object_name, ords_path, enabled_yn
|
||||
FROM cb_protected_object
|
||||
WHERE owner = UPPER(#{owner,jdbcType=VARCHAR})
|
||||
AND object_name = UPPER(#{objectName,jdbcType=VARCHAR})
|
||||
</select>
|
||||
|
||||
<select id="findDatabaseObjects" resultType="com.cloudhandson.vpdbackoffice.domain.protectedobject.DatabaseObjectOption">
|
||||
SELECT owner, object_name, object_type
|
||||
FROM all_objects
|
||||
WHERE object_type IN ('TABLE', 'VIEW')
|
||||
AND owner NOT IN ('SYS', 'SYSTEM', 'ORDS_METADATA', 'ORDS_PUBLIC_USER')
|
||||
AND object_name NOT LIKE 'BIN$%'
|
||||
ORDER BY owner, object_type, object_name
|
||||
FETCH FIRST 500 ROWS ONLY
|
||||
</select>
|
||||
|
||||
<select id="findDatabaseColumns" resultType="string">
|
||||
SELECT column_name
|
||||
FROM all_tab_columns
|
||||
WHERE owner = UPPER(#{owner,jdbcType=VARCHAR})
|
||||
AND table_name = UPPER(#{objectName,jdbcType=VARCHAR})
|
||||
ORDER BY column_id
|
||||
</select>
|
||||
|
||||
<select id="findColumns" resultType="com.cloudhandson.vpdbackoffice.domain.protectedobject.ProtectedColumn">
|
||||
SELECT column_id, object_id, column_name, sensitive_yn, visible_role_id
|
||||
FROM cb_protected_column
|
||||
|
||||
@@ -163,6 +163,11 @@ body {
|
||||
margin-bottom: .75rem;
|
||||
}
|
||||
|
||||
.master-detail {
|
||||
border-bottom: 1px solid var(--rw-border);
|
||||
padding-bottom: 1rem;
|
||||
}
|
||||
|
||||
.rw-btn,
|
||||
.btn {
|
||||
border-radius: 999px;
|
||||
|
||||
@@ -4,3 +4,34 @@ document.body.addEventListener('htmx:responseError', (event) => {
|
||||
target.innerHTML = '<div class="alert alert-danger">요청 처리 중 오류가 발생했습니다.</div>';
|
||||
}
|
||||
});
|
||||
|
||||
function filterUserRoleDetail() {
|
||||
const master = document.getElementById('userRoleMaster');
|
||||
const table = document.getElementById('userRoleDetail');
|
||||
if (!master || !table) {
|
||||
return;
|
||||
}
|
||||
const selected = master.value;
|
||||
let shown = 0;
|
||||
table.querySelectorAll('tbody tr[data-user-id]').forEach((row) => {
|
||||
const visible = row.dataset.userId === selected;
|
||||
row.hidden = !visible;
|
||||
shown += visible ? 1 : 0;
|
||||
});
|
||||
let empty = table.querySelector('tbody tr.empty-user-role-runtime');
|
||||
if (!empty) {
|
||||
empty = document.createElement('tr');
|
||||
empty.className = 'empty-user-role-runtime';
|
||||
empty.innerHTML = '<td colspan="3" class="text-muted">선택한 사용자에게 부여된 역할이 없습니다.</td>';
|
||||
table.querySelector('tbody').appendChild(empty);
|
||||
}
|
||||
empty.hidden = shown !== 0;
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const master = document.getElementById('userRoleMaster');
|
||||
if (master) {
|
||||
master.addEventListener('change', filterUserRoleDetail);
|
||||
filterUserRoleDetail();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
<a class="navbar-brand" href="/">VPD Backoffice</a>
|
||||
<div class="navbar-nav">
|
||||
<a class="nav-link" href="/users">사용자</a>
|
||||
<a class="nav-link" href="/roles">역할</a>
|
||||
<a class="nav-link" href="/permissions">권한</a>
|
||||
<a class="nav-link" href="/objects">테이블/뷰</a>
|
||||
<a class="nav-link" href="/tokens">토큰</a>
|
||||
|
||||
@@ -23,8 +23,17 @@
|
||||
</label>
|
||||
<label>
|
||||
보호 객체
|
||||
<select class="form-select" name="objectId" required>
|
||||
<option th:each="object : ${objects}" th:value="${object.objectId()}" th:text="${object.displayName()}"></option>
|
||||
<select class="form-select" name="objectRef" required>
|
||||
<optgroup label="등록된 보호 객체">
|
||||
<option th:each="object : ${objects}"
|
||||
th:value="${'protected:' + object.objectId()}"
|
||||
th:text="${object.displayName()}"></option>
|
||||
</optgroup>
|
||||
<optgroup label="DB 스키마 객체">
|
||||
<option th:each="dbObject : ${dbObjects}"
|
||||
th:value="${'db:' + dbObject.value()}"
|
||||
th:text="${dbObject.label()}"></option>
|
||||
</optgroup>
|
||||
</select>
|
||||
</label>
|
||||
<label>
|
||||
@@ -41,7 +50,7 @@
|
||||
<input class="form-control" name="ruleValue" placeholder="APAC 또는 HR">
|
||||
</label>
|
||||
<label>
|
||||
표시 컬럼
|
||||
NULL 제외 컬럼
|
||||
<input class="form-control" name="visibleColumns" placeholder="CONTENTS">
|
||||
</label>
|
||||
<button class="btn btn-primary" type="submit">저장</button>
|
||||
@@ -59,7 +68,7 @@
|
||||
<th>테이블/뷰</th>
|
||||
<th>Action</th>
|
||||
<th>행 규칙</th>
|
||||
<th>표시 컬럼</th>
|
||||
<th>NULL 제외 컬럼</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
@@ -12,20 +12,16 @@
|
||||
<section class="content-band">
|
||||
<form hx-post="/probe" hx-target="#probe-result" hx-swap="innerHTML" class="form-grid">
|
||||
<input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}">
|
||||
<label>
|
||||
Token ID
|
||||
<select class="form-select" name="keyId" required>
|
||||
<option th:each="token : ${tokens}" th:value="${token.keyId()}" th:text="${token.keyPrefix()}"></option>
|
||||
</select>
|
||||
</label>
|
||||
<label>
|
||||
Bearer Token 원문
|
||||
<input class="form-control" name="bearerToken" type="password" autocomplete="off" required>
|
||||
</label>
|
||||
<label>
|
||||
보호 객체
|
||||
ORDS 트랙
|
||||
<select class="form-select" name="objectId" required>
|
||||
<option th:each="object : ${objects}" th:value="${object.objectId()}" th:text="${object.displayName()}"></option>
|
||||
<option th:each="object : ${objects}"
|
||||
th:value="${object.objectId()}"
|
||||
th:text="${object.displayName() + ' / ' + object.ordsPath()}"></option>
|
||||
</select>
|
||||
</label>
|
||||
<label>
|
||||
|
||||
62
src/main/resources/templates/roles.html
Normal file
62
src/main/resources/templates/roles.html
Normal file
@@ -0,0 +1,62 @@
|
||||
<!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>사용자에게 부여할 역할을 관리합니다.</p>
|
||||
</div>
|
||||
|
||||
<div class="alert alert-success" th:if="${message}" th:text="${message}"></div>
|
||||
|
||||
<section class="content-band">
|
||||
<h2>역할 추가</h2>
|
||||
<form method="post" action="/roles" class="form-grid">
|
||||
<input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}">
|
||||
<label>
|
||||
역할명
|
||||
<input class="form-control" name="roleName" placeholder="HR_DEPT_ROLE" required>
|
||||
</label>
|
||||
<label>
|
||||
설명
|
||||
<input class="form-control" name="description" maxlength="200">
|
||||
</label>
|
||||
<button class="btn rw-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>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr th:each="role : ${roles}">
|
||||
<td th:text="${role.roleId()}">10</td>
|
||||
<td th:text="${role.roleName()}">HR_DEPT_ROLE</td>
|
||||
<td>
|
||||
<form method="post" action="/roles/delete" class="inline-form">
|
||||
<input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}">
|
||||
<input type="hidden" name="roleId" th:value="${role.roleId()}">
|
||||
<button class="btn btn-sm btn-outline-danger" type="submit">삭제</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
<tr th:if="${#lists.isEmpty(roles)}">
|
||||
<td colspan="3" class="text-muted">등록된 역할이 없습니다.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
@@ -69,30 +69,30 @@
|
||||
</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 user-role-master">
|
||||
<h2>사용자 역할 부여</h2>
|
||||
<div class="master-detail">
|
||||
<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" id="userRoleMaster" 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 rw-btn-primary" type="submit">부여</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<section class="content-band">
|
||||
<h2>사용자 역할 목록</h2>
|
||||
<h2 class="mt-4">선택 사용자 역할</h2>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-sm align-middle">
|
||||
<table class="table table-sm align-middle" id="userRoleDetail">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>사용자</th>
|
||||
@@ -101,7 +101,7 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr th:each="mapping : ${userRoles}">
|
||||
<tr th:each="mapping : ${userRoles}" th:attr="data-user-id=${mapping.userId()}">
|
||||
<td th:text="${mapping.username()}">agent_hr</td>
|
||||
<td th:text="${mapping.roleName()}">HR_DEPT_ROLE</td>
|
||||
<td>
|
||||
@@ -113,7 +113,7 @@
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
<tr th:if="${#lists.isEmpty(userRoles)}">
|
||||
<tr class="empty-user-role-row" th:if="${#lists.isEmpty(userRoles)}">
|
||||
<td colspan="3" class="text-muted">부여된 역할이 없습니다.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
Reference in New Issue
Block a user