HonahX commented on code in PR #1529:
URL: https://github.com/apache/polaris/pull/1529#discussion_r2096522140
##########
service/common/src/main/java/org/apache/polaris/service/admin/PolarisAdminService.java:
##########
@@ -528,6 +533,47 @@ private void authorizeGrantOnTableLikeOperationOrThrow(
catalogRoleWrapper);
}
+ private void authorizeGrantOnPolicyOperationOrThrow(
+ PolarisAuthorizableOperation op,
+ String catalogName,
+ PolicyIdentifier identifier,
+ String catalogRoleName) {
+ resolutionManifest =
+ entityManager.prepareResolutionManifest(callContext, securityContext,
catalogName);
+ resolutionManifest.addPath(
+ new ResolverPath(
+ PolarisCatalogHelpers.identifierToList(identifier.getNamespace(),
identifier.getName()),
+ PolarisEntityType.POLICY),
+ identifier);
+ resolutionManifest.addPath(
+ new ResolverPath(List.of(catalogRoleName),
PolarisEntityType.CATALOG_ROLE),
+ catalogRoleName);
+ ResolverStatus status = resolutionManifest.resolveAll();
+ if (status.getStatus() ==
ResolverStatus.StatusEnum.ENTITY_COULD_NOT_BE_RESOLVED) {
Review Comment:
Thanks for the suggestion! I agree there are lots of chances here to reduce
code duplication. Since the refactor may impact many methods, how about we
doing that in a follow-up? I've opened a draft to attempt a merging for
catalog/namespace/table-like: https://github.com/apache/polaris/pull/1621. We
can add refactor policy ones after this PR gets in.
--
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]