yuqi1129 commented on code in PR #10895:
URL: https://github.com/apache/gravitino/pull/10895#discussion_r3213145505
##########
lance/lance-rest-server/src/main/java/org/apache/gravitino/lance/service/rest/LanceTableOperations.java:
##########
@@ -90,16 +96,37 @@ public Response describeTable(
DescribeTableRequest request) {
try {
validateDescribeTableRequest(request);
+ boolean vendCredentials =
+ request.getVendCredentials() == null ||
Boolean.TRUE.equals(request.getVendCredentials());
+ CredentialPrivilege privilege =
+ vendCredentials ? getCredentialPrivilege(tableId, delimiter) : null;
DescribeTableResponse response =
lanceNamespace
.asTableOps()
- .describeTable(tableId, delimiter,
Optional.ofNullable(request.getVersion()));
+ .describeTable(
+ tableId, delimiter,
Optional.ofNullable(request.getVersion()), privilege);
return Response.ok(response).build();
} catch (Exception e) {
return LanceExceptionMapper.toRESTResponse(tableId, e);
}
}
+ private CredentialPrivilege getCredentialPrivilege(String tableId, String
delimiter) {
+ String[] parts = tableId.split(Pattern.quote(delimiter));
+ if (parts.length != 3) {
+ return CredentialPrivilege.READ;
+ }
+
+ String metalake = lanceNamespace.config().getGravitinoMetalake();
+ NameIdentifier identifier = NameIdentifier.of(metalake, parts[0],
parts[1], parts[2]);
+ boolean writable =
+ MetadataAuthzHelper.checkAccess(
+ identifier,
+ Entity.EntityType.TABLE,
+
AuthorizationExpressionConstants.FILTER_MODIFY_TABLE_AUTHORIZATION_EXPRESSION);
Review Comment:
I see.
--
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]