jerqi commented on code in PR #6770:
URL: https://github.com/apache/gravitino/pull/6770#discussion_r2018108535


##########
authorizations/authorization-ranger/src/main/java/org/apache/gravitino/authorization/ranger/RangerAuthorizationPlugin.java:
##########
@@ -761,18 +772,36 @@ public Boolean onGroupAdded(Group group) throws 
AuthorizationPluginException {
 
   @Override
   public Boolean onGroupRemoved(Group group) throws 
AuthorizationPluginException {
-    VXGroupList list = rangerClient.searchGroup(ImmutableMap.of("name", 
group.name()));
-    if (list.getListSize() == 0) {
-      LOG.warn("The group({}) doesn't exist in the Ranger!", group);
+    VXGroupList vxGroupList = rangerClient.searchGroup(ImmutableMap.of("name", 
group.name()));
+    boolean isExist = false;
+    long groupId = -1;
+    try {
+      for (VXGroup vxGroup : vxGroupList.getList()) {
+        Class<?> clazz = vxGroup.getClass();
+        Field field = clazz.getDeclaredField("name");
+        field.setAccessible(true);
+        String value = (String) field.get(vxGroup);
+        if (group.name().equals(value)) {
+          groupId = vxGroup.getId();
+          isExist = true;
+          break;
+        }
+      }
+    } catch (Exception e) {
+      throw new AuthorizationPluginException("Fail to get the field name of 
class VXGroup");
+    }

Review Comment:
   OK.



##########
api/src/main/java/org/apache/gravitino/authorization/MetadataObjectChange.java:
##########
@@ -41,6 +41,19 @@ static MetadataObjectChange rename(
     return new RenameMetadataObject(metadataObject, newMetadataObject);
   }
 
+  /**
+   * Rename a metadata entity MetadataObjectChange.
+   *
+   * @param metadataObject The metadata object.
+   * @param newMetadataObject The new metadata object.
+   * @param locations The locations of the metadata object.
+   * @return return a MetadataObjectChange for the rename metadata object.
+   */
+  static MetadataObjectChange rename(
+      MetadataObject metadataObject, MetadataObject newMetadataObject, 
List<String> locations) {

Review Comment:
   OK.



-- 
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: commits-unsubscr...@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to