theoryxu commented on code in PR #5629:
URL: https://github.com/apache/gravitino/pull/5629#discussion_r1851261388
##########
authorizations/authorization-ranger/src/main/java/org/apache/gravitino/authorization/ranger/RangerHelper.java:
##########
@@ -234,15 +234,32 @@ public RangerPolicy
findManagedPolicy(RangerMetadataObject rangerMetadataObject)
RangerPolicy policy = policies.get(0);
// Delegating Gravitino management policies cannot contain duplicate
privilege
- policy.getPolicyItems().forEach(this::checkPolicyItemAccess);
- policy.getDenyPolicyItems().forEach(this::checkPolicyItemAccess);
- policy.getRowFilterPolicyItems().forEach(this::checkPolicyItemAccess);
- policy.getDataMaskPolicyItems().forEach(this::checkPolicyItemAccess);
+ policy.getPolicyItems().stream()
+ .filter(this::isGravitinoManagedPolicyItemAccess)
+ .forEach(this::checkPolicyItemAccess);
+ policy.getDenyPolicyItems().stream()
+ .filter(this::isGravitinoManagedPolicyItemAccess)
+ .forEach(this::checkPolicyItemAccess);
+ policy.getRowFilterPolicyItems().stream()
+ .filter(this::isGravitinoManagedPolicyItemAccess)
+ .forEach(this::checkPolicyItemAccess);
+ policy.getDataMaskPolicyItems().stream()
+ .filter(this::isGravitinoManagedPolicyItemAccess)
+ .forEach(this::checkPolicyItemAccess);
return policy;
}
+ boolean isGravitinoManagedPolicyItemAccess(RangerPolicy.RangerPolicyItem
policyItem) {
+ return policyItem.getRoles().stream().anyMatch(role ->
role.startsWith(GRAVITINO_ROLE_PREFIX));
+ }
+
+ boolean isNotGravitinoManagedPolicyItemAccess(RangerPolicy.RangerPolicyItem
policyItem) {
+ return !isGravitinoManagedPolicyItemAccess(policyItem);
Review Comment:
removed it
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]