Abyss-lord commented on code in PR #7167:
URL: https://github.com/apache/gravitino/pull/7167#discussion_r2108258360
##########
server-common/src/main/java/org/apache/gravitino/server/authorization/MetadataFilterHelper.java:
##########
@@ -39,23 +46,86 @@ private MetadataFilterHelper() {}
* @param metadataList metadata list.
* @return metadata List that the user has permission to access.
*/
- @DoNotCall
public static NameIdentifier[] filter(
Review Comment:
Consider renaming the `filter` method to `filterByPrivilege` to make its
purpose clearer. Since the method filters metadata objects based on the current
user's privileges, a more descriptive name would improve readability and
maintainability.
##########
api/src/main/java/org/apache/gravitino/MetadataObjects.java:
##########
@@ -38,6 +38,22 @@ public class MetadataObjects {
private MetadataObjects() {}
+ /**
+ * Build the MetadataObject through metadataType and metadataName.
+ *
+ * @param metadataType metadata type
+ * @param metadataName metadata NameIdentifier
+ * @return MetadataObject
+ */
+ public static MetadataObject of(MetadataObject.Type metadataType,
NameIdentifier metadataName) {
+ String namespaceWithMetalake = metadataName.namespace().toString();
+ String metadataParent = StringUtils.substringAfter(namespaceWithMetalake,
".");
Review Comment:
We could consider extracting this logic into a reusable utility method, such
as `extractParentWithoutMetalake`, since this pattern seems to be used in
multiple places. It would help improve code readability and reduce duplication.
--
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]