HonahX commented on code in PR #1529:
URL: https://github.com/apache/polaris/pull/1529#discussion_r2096522587
##########
service/common/src/main/java/org/apache/polaris/service/admin/PolarisAdminService.java:
##########
@@ -1937,4 +2023,68 @@ private boolean revokePrivilegeOnTableLikeFromRole(
privilege)
.isSuccess();
}
+
+ private boolean grantPrivilegeOnPolicyEntityToRole(
+ String catalogName,
+ String catalogRoleName,
+ PolicyIdentifier identifier,
+ PolarisPrivilege privilege) {
+ if (findCatalogByName(catalogName).isEmpty()) {
+ throw new NotFoundException("Parent catalog %s not found", catalogName);
+ }
+ PolarisEntity catalogRoleEntity =
+ findCatalogRoleByName(catalogName, catalogRoleName)
+ .orElseThrow(() -> new NotFoundException("CatalogRole %s not
found", catalogRoleName));
+
+ PolarisResolvedPathWrapper resolvedPathWrapper =
+ resolutionManifest.getResolvedPath(
+ identifier, PolarisEntityType.POLICY,
PolarisEntitySubType.ANY_SUBTYPE);
+ if (resolvedPathWrapper == null) {
+ throw new NoSuchPolicyException(String.format("Policy not exists: %s",
identifier));
+ }
+
+ List<PolarisEntity> catalogPath = resolvedPathWrapper.getRawParentPath();
Review Comment:
Thanks! Similar as above, how about we do all the refactoring as a whole in
https://github.com/apache/polaris/pull/1621 once this is 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]