fix #490: align vpd policy apply hierarchy
This commit is contained in:
@@ -139,6 +139,7 @@ public class VpdPolicyService {
|
||||
String schemaOwner,
|
||||
boolean includeTables,
|
||||
boolean includeViews,
|
||||
String policyNameValue,
|
||||
String functionKey,
|
||||
String functionOwnerValue,
|
||||
String functionNameValue,
|
||||
@@ -160,6 +161,9 @@ public class VpdPolicyService {
|
||||
throw new AppException("선택한 스키마에서 VPD 적용 대상 TABLE/VIEW를 찾을 수 없습니다: " + owner);
|
||||
}
|
||||
|
||||
String bulkPolicyName = policyNameValue == null || policyNameValue.isBlank()
|
||||
? COMMON_POLICY_NAME
|
||||
: requiredIdentifier(policyNameValue, "Policy name");
|
||||
FunctionRef functionRef = parseFunctionRef(defaultFunctionKey(functionKey));
|
||||
String filterPredicate = filterPredicateValue == null ? "" : filterPredicateValue.trim();
|
||||
if (functionRef == null && filterPredicate.isBlank()) {
|
||||
@@ -197,8 +201,7 @@ public class VpdPolicyService {
|
||||
int skipped = 0;
|
||||
int failed = 0;
|
||||
for (VpdSchemaObjectOption target : targets) {
|
||||
String policyName = generatedPolicyName(target.objectName());
|
||||
if (mapper.findAnyPolicy(target.owner(), target.objectName(), policyName) != null) {
|
||||
if (mapper.findAnyPolicy(target.owner(), target.objectName(), bulkPolicyName) != null) {
|
||||
skipped++;
|
||||
continue;
|
||||
}
|
||||
@@ -206,7 +209,7 @@ public class VpdPolicyService {
|
||||
addPolicy(
|
||||
target.owner(),
|
||||
target.objectName(),
|
||||
policyName,
|
||||
bulkPolicyName,
|
||||
functionOwner,
|
||||
packageName == null ? functionName : packageName + "." + functionName,
|
||||
statementTypes,
|
||||
@@ -538,10 +541,6 @@ public class VpdPolicyService {
|
||||
return generated.length() > 128 ? generated.substring(0, 128) : generated;
|
||||
}
|
||||
|
||||
private String generatedPolicyName(String objectName) {
|
||||
return COMMON_POLICY_NAME;
|
||||
}
|
||||
|
||||
private FunctionRef parseFunctionRef(String functionKey) {
|
||||
if (functionKey == null || functionKey.isBlank()) {
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user