[Developer] #571 show VPD context in SQL trace

This commit is contained in:
devmrko
2026-06-30 14:29:54 +09:00
parent 8978be4182
commit fb93781925
3 changed files with 69 additions and 0 deletions

View File

@@ -117,6 +117,26 @@
<span class="badge text-bg-light">DBMS_RLS predicate</span>
</div>
<div class="probe-exchange-grid mt-3">
<section class="probe-exchange" data-sql-trace-field="vpd_context" th:if="${tokenContext}">
<h3>set_vpd_context 사용자 컨텍스트</h3>
<p class="form-hint">이 컨텍스트로 권한 규칙을 계산한 뒤 아래 VPD predicate와 effective SQL을 만들었습니다.</p>
<dl class="mb-0">
<div><dt>CB_AGENT_CTX.USER_ID</dt><dd th:text="${tokenContext.userId()}">103</dd></div>
<div><dt>사용자</dt><dd th:text="${tokenContext.username()}">agent_all</dd></div>
<div>
<dt>직접 역할</dt>
<dd th:text="${#lists.isEmpty(tokenContext.directRoles()) ? '없음' : #strings.listJoin(tokenContext.directRoles(), ', ')}">ALL_DOC_ROLE</dd>
</div>
<div>
<dt>소속 그룹</dt>
<dd th:text="${#lists.isEmpty(tokenContext.groups()) ? '없음' : #strings.listJoin(tokenContext.groups(), ', ')}">없음</dd>
</div>
<div>
<dt>상속 역할</dt>
<dd th:text="${#lists.isEmpty(tokenContext.inheritedRoles()) ? '없음' : #strings.listJoin(tokenContext.inheritedRoles(), ', ')}">없음</dd>
</div>
</dl>
</section>
<section class="probe-exchange" data-sql-trace-field="vpd_predicate">
<h3>VPD가 추가한 WHERE 조건</h3>
<pre th:text="${result.vpdPredicate()}">(DEPT_CODE = SYS_CONTEXT('CB_AGENT_CTX', 'DEPT_CODE'))</pre>