hdygxsj commented on code in PR #7898:
URL: https://github.com/apache/gravitino/pull/7898#discussion_r2250511526


##########
server/src/main/java/org/apache/gravitino/server/web/rest/MetadataObjectRoleOperations.java:
##########
@@ -70,6 +76,22 @@ public Response listRoles(
           httpRequest,
           () -> {
             String[] names = 
accessControlDispatcher.listRoleNamesByObject(metalake, object);
+            names =
+                Arrays.stream(names)
+                    .filter(
+                        role -> {
+                          NameIdentifier[] nameIdentifiers =
+                              new NameIdentifier[] 
{NameIdentifierUtil.ofRole(metalake, role)};
+                          return MetadataFilterHelper.filterByExpression(
+                                      metalake,
+                                      "METALAKE::OWNER || ROLE::OWNER || 
ROLE::SELF",
+                                      Entity.EntityType.ROLE,
+                                      nameIdentifiers)
+                                  .length
+                              > 0;
+                        })
+                    .collect(Collectors.toList())
+                    .toArray(new String[0]);

Review Comment:
   Will be optimized in https://github.com/apache/gravitino/issues/7914



##########
server/src/main/java/org/apache/gravitino/server/web/rest/MetadataObjectRoleOperations.java:
##########
@@ -70,6 +76,22 @@ public Response listRoles(
           httpRequest,
           () -> {
             String[] names = 
accessControlDispatcher.listRoleNamesByObject(metalake, object);
+            names =
+                Arrays.stream(names)
+                    .filter(
+                        role -> {
+                          NameIdentifier[] nameIdentifiers =
+                              new NameIdentifier[] 
{NameIdentifierUtil.ofRole(metalake, role)};
+                          return MetadataFilterHelper.filterByExpression(
+                                      metalake,
+                                      "METALAKE::OWNER || ROLE::OWNER || 
ROLE::SELF",

Review Comment:
   Will be optimized in https://github.com/apache/gravitino/issues/7914



-- 
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]

Reply via email to