fix #477: use vpd targets in policy dropdowns

This commit is contained in:
devmrko
2026-06-26 05:50:25 +09:00
parent e806a92e98
commit f0782a10d9
3 changed files with 7 additions and 12 deletions

View File

@@ -2,7 +2,6 @@ package com.cloudhandson.vpdbackoffice.web;
import com.cloudhandson.vpdbackoffice.domain.vpd.VpdPolicyCreateCommand; import com.cloudhandson.vpdbackoffice.domain.vpd.VpdPolicyCreateCommand;
import com.cloudhandson.vpdbackoffice.service.AppException; import com.cloudhandson.vpdbackoffice.service.AppException;
import com.cloudhandson.vpdbackoffice.service.ProtectedObjectService;
import com.cloudhandson.vpdbackoffice.service.VpdPolicyService; import com.cloudhandson.vpdbackoffice.service.VpdPolicyService;
import java.util.List; import java.util.List;
import org.springframework.dao.DataAccessException; import org.springframework.dao.DataAccessException;
@@ -17,11 +16,9 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
public class VpdPolicyController { public class VpdPolicyController {
private final VpdPolicyService vpdPolicyService; private final VpdPolicyService vpdPolicyService;
private final ProtectedObjectService protectedObjectService;
public VpdPolicyController(VpdPolicyService vpdPolicyService, ProtectedObjectService protectedObjectService) { public VpdPolicyController(VpdPolicyService vpdPolicyService) {
this.vpdPolicyService = vpdPolicyService; this.vpdPolicyService = vpdPolicyService;
this.protectedObjectService = protectedObjectService;
} }
@GetMapping("/vpd-policies") @GetMapping("/vpd-policies")
@@ -40,14 +37,12 @@ public class VpdPolicyController {
try { try {
model.addAttribute("policies", vpdPolicyService.findPolicies()); model.addAttribute("policies", vpdPolicyService.findPolicies());
model.addAttribute("vpdTargets", vpdPolicyService.findVpdTargets()); model.addAttribute("vpdTargets", vpdPolicyService.findVpdTargets());
model.addAttribute("objects", protectedObjectService.findEnabled());
model.addAttribute("formOptions", vpdPolicyService.formOptions()); model.addAttribute("formOptions", vpdPolicyService.formOptions());
} catch (DataAccessException exception) { } catch (DataAccessException exception) {
RuntimeErrorMessage message = RuntimeErrorMessages.dataAccess(exception); RuntimeErrorMessage message = RuntimeErrorMessages.dataAccess(exception);
model.addAttribute("runtimeError", message); model.addAttribute("runtimeError", message);
model.addAttribute("policies", List.of()); model.addAttribute("policies", List.of());
model.addAttribute("vpdTargets", List.of()); model.addAttribute("vpdTargets", List.of());
model.addAttribute("objects", List.of());
model.addAttribute("formOptions", vpdPolicyService.emptyFormOptions()); model.addAttribute("formOptions", vpdPolicyService.emptyFormOptions());
} }
} }

View File

@@ -132,9 +132,9 @@
<label> <label>
VPD 적용 대상 TABLE/VIEW VPD 적용 대상 TABLE/VIEW
<select class="form-select" name="objectKey" required> <select class="form-select" name="objectKey" required>
<option th:each="object : ${objects}" <option th:each="target : ${vpdTargets}"
th:value="${object.owner() + '.' + object.objectName()}" th:value="${target.objectDisplayName()}"
th:text="${object.displayName()}"></option> th:text="${target.objectDisplayName() + ' / ' + target.objectType() + (target.vpdApplied() ? ' / VPD 적용됨' : ' / 미적용')}"></option>
</select> </select>
</label> </label>
<label> <label>

View File

@@ -86,9 +86,9 @@
<label> <label>
VPD 적용 대상 TABLE/VIEW VPD 적용 대상 TABLE/VIEW
<select class="form-select" name="objectKey" required> <select class="form-select" name="objectKey" required>
<option th:each="object : ${objects}" <option th:each="target : ${vpdTargets}"
th:value="${object.owner() + '.' + object.objectName()}" th:value="${target.objectDisplayName()}"
th:text="${object.displayName()}"></option> th:text="${target.objectDisplayName() + ' / ' + target.objectType() + (target.vpdApplied() ? ' / VPD 적용됨' : ' / 미적용')}"></option>
</select> </select>
</label> </label>
<label> <label>