[Developer] #424 show VPD policy function source

This commit is contained in:
devmrko
2026-06-25 11:10:20 +09:00
parent 56c6432d86
commit 86e2b252c9
8 changed files with 126 additions and 2 deletions

View File

@@ -27,4 +27,12 @@
FROM all_policies
ORDER BY object_owner, object_name, policy_name
</select>
<select id="findFunctionSource" resultType="string">
SELECT LISTAGG(text, '') WITHIN GROUP (ORDER BY line)
FROM all_source
WHERE owner = UPPER(#{owner,jdbcType=VARCHAR})
AND name = UPPER(#{objectName,jdbcType=VARCHAR})
AND type = UPPER(#{objectType,jdbcType=VARCHAR})
</select>
</mapper>

View File

@@ -457,6 +457,18 @@ body {
white-space: pre-wrap;
}
.policy-function-button {
border-radius: 8px;
max-width: 100%;
overflow-wrap: anywhere;
text-align: left;
}
.policy-source-cell {
background: var(--rw-surface) !important;
padding: 0 0 .75rem !important;
}
.ai-answer {
background: var(--rw-primary-soft);
border: 1px solid var(--rw-border);

View File

@@ -0,0 +1,16 @@
<!doctype html>
<html lang="ko" xmlns:th="http://www.thymeleaf.org">
<body>
<div th:fragment="source">
<div class="alert alert-warning mb-0" th:if="${errorMessage}" th:text="${errorMessage}"></div>
<section class="probe-exchange" th:if="${source}">
<h3>
<span th:text="${source.owner() + '.' + source.objectName()}">OWNER.OBJECT</span>
<span class="text-muted" th:text="${' / ' + source.objectType()}"> / FUNCTION</span>
</h3>
<pre th:if="${source.found()}" th:text="${source.source()}"></pre>
<pre th:unless="${source.found()}">ALL_SOURCE에서 조회 가능한 소스가 없습니다. 현재 DB 계정의 소스 조회 권한을 확인하세요.</pre>
</section>
</div>
</body>
</html>

View File

@@ -34,13 +34,22 @@
</tr>
</thead>
<tbody>
<tr th:each="policy : ${policies}">
<th:block th:each="policy, iter : ${policies}">
<tr>
<td>
<strong th:text="${policy.objectDisplayName()}">ADMIN.TABLE</strong>
<div class="text-muted small" th:text="${policy.policyGroup()}">SYS_DEFAULT</div>
</td>
<td><code th:text="${policy.policyName()}">POLICY</code></td>
<td><code th:text="${policy.functionDisplayName()}">OWNER.FUNC</code></td>
<td>
<button class="btn btn-sm btn-outline-secondary policy-function-button"
type="button"
th:hx-get="@{/vpd-policies/function-source(owner=${policy.functionOwner()},packageName=${policy.packageName()},functionName=${policy.functionName()})}"
th:hx-target="${'#policy-source-' + iter.index}"
hx-swap="innerHTML">
<code th:text="${policy.functionDisplayName()}">OWNER.FUNC</code>
</button>
</td>
<td th:text="${policy.statementTypes()} ?: '-'">SELECT</td>
<td>
<span class="badge"
@@ -54,6 +63,14 @@
<span class="ms-2">Long: <strong th:text="${policy.longPredicate()}">NO</strong></span>
</td>
</tr>
<tr>
<td colspan="7" class="policy-source-cell">
<div th:id="${'policy-source-' + iter.index}" class="text-muted small">
Policy function을 클릭하면 소스가 표시됩니다.
</div>
</td>
</tr>
</th:block>
<tr th:if="${#lists.isEmpty(policies)}">
<td colspan="7" class="text-muted">
조회 가능한 VPD policy가 없습니다. 정책이 없거나 현재 DB 계정에 dictionary 조회 권한이 없을 수 있습니다.