xunliu commented on code in PR #6100:
URL: https://github.com/apache/gravitino/pull/6100#discussion_r1904135067
##########
core/src/main/java/org/apache/gravitino/authorization/AuthorizationUtils.java:
##########
@@ -364,4 +376,123 @@ private static void checkCatalogType(
catalogIdent, catalog.type(), privilege);
}
}
+
+ public static List<String> getMetadataObjectLocation(
+ NameIdentifier ident, Entity.EntityType type) {
+ List<String> locations = new ArrayList<>();
+ MetadataObject metadataObject;
+ try {
+ metadataObject = NameIdentifierUtil.toMetadataObject(ident, type);
+ } catch (IllegalArgumentException e) {
+ LOG.warn("Illegal argument exception for metadata object %s type %s",
ident, type, e);
+ return locations;
+ }
+
+ String metalake =
+ (type == Entity.EntityType.METALAKE ? ident.name() :
ident.namespace().level(0));
+ try {
+ switch (metadataObject.type()) {
+ case METALAKE:
Review Comment:
For example, When we grant `CreateSchema` privilege under a metalake, Just
like my ITs `TestChainedAuthorizationIT`.
```
SecurableObject securableObject =
SecurableObjects.ofMetalake(
metalakeName,
Lists.newArrayList(Privileges.CreateSchema.allow()));
```
--
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]