yuqi1129 commented on code in PR #11404:
URL: https://github.com/apache/gravitino/pull/11404#discussion_r3353276085


##########
server-common/src/main/java/org/apache/gravitino/server/authorization/jcasbin/JcasbinAuthorizer.java:
##########
@@ -1033,36 +1034,18 @@ private List<Long> loadGroupRoles(
    * or has no groups.
    */
   private List<String> currentPrincipalGroupNames() {
-    Principal principal = PrincipalUtils.getCurrentPrincipal();
-    if (!(principal instanceof UserPrincipal)) {
-      return new ArrayList<>();
-    }
-    List<UserGroup> groups = ((UserPrincipal) principal).getGroups();
-    if (groups.isEmpty()) {
-      return new ArrayList<>();
-    }
-    return 
groups.stream().map(UserGroup::getGroupname).collect(Collectors.toList());
+    return principalGroupNames(PrincipalUtils.getCurrentPrincipal());
   }
 
-  /**
-   * Resolves GroupEntity objects for the current principal's groups, skipping 
any that are stale or
-   * not found in the store. Used by owner checks that need full group 
entities instead of only
-   * group names.
-   */
-  private List<GroupEntity> resolveCurrentUserGroups(String metalake, 
EntityStore entityStore) {
-    Principal principal = PrincipalUtils.getCurrentPrincipal();
+  private List<String> principalGroupNames(Principal principal) {
     if (!(principal instanceof UserPrincipal)) {
       return new ArrayList<>();
     }
     List<UserGroup> groups = ((UserPrincipal) principal).getGroups();
     if (groups.isEmpty()) {
       return new ArrayList<>();
     }
-    List<NameIdentifier> groupIdents =
-        groups.stream()
-            .map(g -> NameIdentifierUtil.ofGroup(metalake, g.getGroupname()))
-            .collect(Collectors.toList());
-    return entityStore.batchGet(groupIdents, Entity.EntityType.GROUP, 
GroupEntity.class);
+    return 
groups.stream().map(UserGroup::getGroupname).collect(Collectors.toList());

Review Comment:
   This is a previous naming problem introduced by others, and I will change 
it, by the way. 



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