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


##########
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:
   We don't store role name in the underlying relational database. It's 
necessary for us to  assign the role names fields in the user entity.  The 
updated user entity will be returned to end user. The users of requests need 
role names for human understanding.



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