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


##########
authorizations/authorization-ranger/src/main/java/org/apache/gravitino/authorization/ranger/RangerAuthorizationPlugin.java:
##########
@@ -1044,4 +1044,34 @@ public boolean 
validAuthorizationOperation(List<SecurableObject> securableObject
               return match.get();
             });
   }
+
+  private Optional<Long> getUserId(String name) {
+    VXUserList list = rangerClient.searchUser(ImmutableMap.of("name", name));
+    if (list.getListSize() > 0) {
+      for (VXUser vxUser : list.getList()) {
+        if (vxUser.getName().equals(name)) {
+          return Optional.of(vxUser.getId());
+        }
+      }
+    }
+    return Optional.empty();
+  }
+
+  private Optional<Long> getGroupId(String name) {
+    VXGroupList vxGroupList = rangerClient.searchGroup(ImmutableMap.of("name", 
name));
+    try {
+      for (VXGroup group : vxGroupList.getList()) {
+        Class<?> clazz = group.getClass();
+        Field field = clazz.getDeclaredField("name");
+        field.setAccessible(true);
+        String value = (String) field.get(group);

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