jerryshao commented on code in PR #4121:
URL: https://github.com/apache/gravitino/pull/4121#discussion_r1672201923


##########
core/src/main/java/com/datastrato/gravitino/authorization/PermissionManager.java:
##########
@@ -67,9 +67,12 @@ User grantRolesToUser(String metalake, List<String> roles, 
String user) {
           UserEntity.class,
           Entity.EntityType.USER,
           userEntity -> {
-            List<RoleEntity> roleEntities =
-                roleManager.getValidRoles(metalake, userEntity.roleNames(), 
userEntity.roleIds());
-
+            List<RoleEntity> roleEntities = Lists.newArrayList();
+            if (userEntity.roleNames() != null) {
+              for (String role : userEntity.roleNames()) {
+                roleEntities.add(roleManager.getRole(metalake, role));
+              }
+            }

Review Comment:
   I would suggest that we don't store the role name in user entity, only store 
the id, and we don't need to check role name, but the role id.



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