[Developer] #424 default protected object lookup mapping

This commit is contained in:
devmrko
2026-06-23 14:49:40 +09:00
parent e5ba9aedd7
commit be4f337802
5 changed files with 81 additions and 8 deletions

View File

@@ -60,6 +60,43 @@ async function syncRuleColumnOptions() {
}
}
async function syncObjectCatalogSelection() {
const catalog = document.getElementById('objectCatalogSelect');
if (!catalog || !catalog.value) {
return;
}
const selected = catalog.options[catalog.selectedIndex];
const ownerInput = document.querySelector('input[name="owner"]');
const objectInput = document.querySelector('input[name="objectName"]');
const ordsPathInput = document.querySelector('input[name="ordsPath"]');
const columnsInput = document.querySelector('input[name="columns"]');
if (ownerInput) {
ownerInput.value = selected.dataset.owner || '';
}
if (objectInput) {
objectInput.value = selected.dataset.objectName || '';
}
if (ordsPathInput) {
ordsPathInput.value = selected.dataset.defaultPath || '';
}
if (!columnsInput) {
return;
}
columnsInput.value = '';
try {
const response = await fetch(`/permissions/object-columns?objectRef=${encodeURIComponent(`db:${catalog.value}`)}`);
if (!response.ok) {
return;
}
const columns = await response.json();
if (Array.isArray(columns)) {
columnsInput.value = columns.join(',');
}
} catch (error) {
columnsInput.value = '';
}
}
document.addEventListener('DOMContentLoaded', () => {
const master = document.getElementById('userRoleMaster');
if (master) {
@@ -71,6 +108,10 @@ document.addEventListener('DOMContentLoaded', () => {
objectSelect.addEventListener('change', syncRuleColumnOptions);
syncRuleColumnOptions();
}
const catalog = document.getElementById('objectCatalogSelect');
if (catalog) {
catalog.addEventListener('change', syncObjectCatalogSelection);
}
document.querySelectorAll('[data-rule-add]').forEach((button) => {
button.addEventListener('click', () => {
const row = button.closest('.rule-row');

View File

@@ -6,7 +6,7 @@
<main class="container py-4">
<div class="page-title">
<h1>테이블/뷰 관리</h1>
<p>권한에 사용할 보호 객체와 ORDS 경로를 등록합니다.</p>
<p>권한에 사용할 보호 객체와 이미 구성된 ORDS 조회 경로를 매핑합니다.</p>
</div>
<div class="alert alert-success" th:if="${message}" th:text="${message}"></div>
@@ -15,17 +15,29 @@
<h2>테이블/뷰 추가</h2>
<form method="post" action="/objects" class="form-grid">
<input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}">
<label>
DB 객체 선택
<select class="form-select" id="objectCatalogSelect">
<option value="">직접 입력</option>
<option th:each="dbObject : ${dbObjects}"
th:value="${dbObject.value()}"
th:data-owner="${dbObject.owner()}"
th:data-object-name="${dbObject.objectName()}"
th:data-default-path="${dbObject.defaultOrdsPath()}"
th:text="${dbObject.label()}"></option>
</select>
</label>
<label>
Owner
<input class="form-control" name="owner" value="ADMIN" required>
<input class="form-control" name="owner" value="ADMIN" autocomplete="off" required>
</label>
<label>
Object
<input class="form-control" name="objectName" placeholder="CB_V_SEARCH_DOCUMENTS" required>
<input class="form-control" name="objectName" placeholder="CB_V_SEARCH_DOCUMENTS" autocomplete="off" required>
</label>
<label>
ORDS Path
<input class="form-control" name="ordsPath" placeholder="cb-ords/cb-agent-security/vpd/documents" required>
<input class="form-control" name="ordsPath" placeholder="admin/cb_v_search_documents">
</label>
<label>
컬럼