mneethiraj commented on code in PR #1230:
URL: https://github.com/apache/ranger/pull/1230#discussion_r3993766707


##########
security-admin/src/main/java/org/apache/ranger/biz/RangerBizUtil.java:
##########
@@ -1061,22 +1060,23 @@ public boolean checkUserAccessible(VXUser vXUser) {
             return true;
         }
 
-        boolean            isAccessible = true;
-        Collection<String> roleList     = 
userMgr.getRolesByLoginId(vXUser.getName());
+        boolean      isAccessible      = true;
+        List<String> payloadRoles      = 
StringUtil.transformElements(vXUser.getUserRoleList(), s -> 
s.trim().toUpperCase());

Review Comment:
   Instead of creating new lists with upper case role names, consider adding 
following method and calling it from here:
   
   ```
   package org.apache.ranger.authorization.utils;
   
   public class StringUtil {
     ...
     public static boolean containsIgnoreCase(Collection<String> values, String 
str) {
       if (values != null && str != null) {
         return values.stream().anyMatch(s -> str.equalsIgnoreCase(s));
       }
   
       return false;
     }
     ...
   }
   ```



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