fix #477: list vpd target objects

This commit is contained in:
devmrko
2026-06-26 05:34:56 +09:00
parent 6e4a306dcd
commit 91b03ed952
9 changed files with 173 additions and 4 deletions

View File

@@ -38,6 +38,45 @@
ORDER BY p.object_owner, p.object_name, p.policy_name
</select>
<select id="findVpdTargets" resultType="com.cloudhandson.vpdbackoffice.domain.vpd.VpdTargetView">
WITH managed_owners AS (
SELECT USER AS owner FROM dual
UNION
SELECT owner FROM cb_protected_object
),
managed_objects AS (
SELECT owner, object_name, object_type
FROM all_objects
WHERE object_type IN ('TABLE', 'VIEW')
AND owner IN (SELECT owner FROM managed_owners)
AND owner NOT IN ('SYS', 'SYSTEM', 'ORDS_METADATA', 'ORDS_PUBLIC_USER')
AND owner NOT LIKE 'APEX\_%' ESCAPE '\'
AND owner NOT LIKE 'C##%'
AND object_name NOT LIKE 'BIN$%'
)
SELECT o.owner,
o.object_name,
o.object_type,
CASE WHEN po.object_id IS NULL THEN 'N' ELSE po.enabled_yn END AS protected_yn,
po.ords_path,
COUNT(p.policy_name) AS policy_count,
LISTAGG(p.policy_name, ', ') WITHIN GROUP (ORDER BY p.policy_name) AS policy_names
FROM managed_objects o
LEFT JOIN cb_protected_object po
ON po.owner = o.owner
AND po.object_name = o.object_name
AND po.enabled_yn = 'Y'
LEFT JOIN all_policies p
ON p.object_owner = o.owner
AND p.object_name = o.object_name
GROUP BY o.owner, o.object_name, o.object_type, po.object_id, po.enabled_yn, po.ords_path
ORDER BY CASE WHEN COUNT(p.policy_name) > 0 THEN 0 ELSE 1 END,
o.owner,
o.object_type,
o.object_name
FETCH FIRST 500 ROWS ONLY
</select>
<select id="findPolicyNameOptions" resultType="string">
SELECT DISTINCT policy_name
FROM all_policies

View File

@@ -305,7 +305,7 @@ body {
.section-heading h2 {
font-size: 1rem;
font-weight: 700;
margin: 0 0 1rem;
margin: 0;
}
.section-heading {
@@ -313,6 +313,13 @@ body {
display: flex;
justify-content: space-between;
gap: 1rem;
margin-bottom: 1rem;
}
.section-subtitle {
color: var(--rw-muted);
font-size: .875rem;
margin: .2rem 0 0;
}
.form-grid {

View File

@@ -26,6 +26,57 @@
<p class="text-muted mb-0">VPD는 개별 보호 객체 적용을 기본으로 하고, 같은 정책을 스키마 TABLE/VIEW에 확장할 때만 벌크 적용을 사용합니다.</p>
</section>
<section class="content-band">
<div class="section-heading">
<div>
<h2>VPD 적용 대상 TABLE/VIEW</h2>
<p class="section-subtitle">Oracle DB catalog 기준의 TABLE/VIEW 목록입니다. ORDS는 이 객체를 HTTP로 서빙하는 별도 레이어입니다.</p>
</div>
<span class="badge text-bg-secondary" th:text="${#lists.size(vpdTargets)}">0</span>
</div>
<div class="table-responsive">
<table class="table table-sm align-middle">
<thead>
<tr>
<th>Object</th>
<th>Type</th>
<th>VPD 상태</th>
<th>Policy</th>
<th>백오피스 권한 테이블</th>
<th>ORDS Path</th>
</tr>
</thead>
<tbody>
<tr th:each="target : ${vpdTargets}">
<td><code th:text="${target.objectDisplayName()}">ADMIN.TABLE</code></td>
<td th:text="${target.objectType()}">TABLE</td>
<td>
<span class="badge"
th:classappend="${target.vpdApplied()} ? ' text-bg-success' : ' text-bg-secondary'"
th:text="${target.vpdApplied()} ? 'VPD 적용됨' : '미적용'">미적용</span>
</td>
<td>
<span th:if="${target.vpdApplied()}" th:text="${target.policyNames()}">POLICY</span>
<span th:unless="${target.vpdApplied()}" class="text-muted">-</span>
</td>
<td>
<span class="badge"
th:classappend="${target.protectedObject()} ? ' text-bg-primary' : ' text-bg-light'"
th:text="${target.protectedObject()} ? '등록됨' : '미등록'">미등록</span>
</td>
<td>
<code th:if="${target.ordsPath()}" th:text="${target.ordsPath()}">cb-ords/path</code>
<span th:unless="${target.ordsPath()}" class="text-muted">ORDS 서빙 미등록</span>
</td>
</tr>
<tr th:if="${#lists.isEmpty(vpdTargets)}">
<td colspan="6" class="text-muted">조회 가능한 TABLE/VIEW가 없습니다. DB 연결 사용자 권한과 스키마 객체를 확인하세요.</td>
</tr>
</tbody>
</table>
</div>
</section>
<section class="content-band">
<div class="section-heading">
<h2>개별 적용</h2>