sungwy commented on code in PR #3681:
URL: https://github.com/apache/polaris/pull/3681#discussion_r2796146445
##########
runtime/service/src/main/java/org/apache/polaris/service/admin/PolarisAdminService.java:
##########
@@ -217,23 +258,23 @@ private static CatalogEntity getCatalogByName(
private static CatalogRoleEntity getCatalogRoleByName(
PolarisResolutionManifest resolutionManifest, String catalogRoleName) {
- return
Optional.ofNullable(resolutionManifest.getResolvedPath(catalogRoleName))
+ PolarisSecurable catalogRoleSecurable =
+ new PolarisSecurable(PolarisEntityType.CATALOG_ROLE,
List.of(catalogRoleName));
+ return
Optional.ofNullable(resolutionManifest.getResolvedPath(catalogRoleSecurable))
.map(PolarisResolvedPathWrapper::getRawLeafEntity)
.map(CatalogRoleEntity::of)
.orElseThrow(() -> new NotFoundException("CatalogRole %s not found",
catalogRoleName));
}
private void authorizeBasicRootOperationOrThrow(PolarisAuthorizableOperation
op) {
PolarisResolutionManifest resolutionManifest = newResolutionManifest(null);
- resolutionManifest.resolveAll();
- PolarisResolvedPathWrapper rootContainerWrapper =
- resolutionManifest.getResolvedRootContainerEntityAsPath();
- authorizer.authorizeOrThrow(
- polarisPrincipal,
- resolutionManifest.getAllActivatedPrincipalRoleEntities(),
- op,
- rootContainerWrapper,
- null /* secondary */);
+ AuthorizationState authzContext = authorizationState;
+ authzContext.setResolutionManifest(resolutionManifest);
+ authorizer.preAuthorize(authzContext, newAuthorizationRequest(op));
+ PolarisSecurable rootSecurable =
Review Comment:
That's a great idea @adutra - thank you!
--
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]