zddr commented on code in PR #38436: URL: https://github.com/apache/doris/pull/38436#discussion_r1696425649
########## fe/fe-core/src/main/java/org/apache/doris/mysql/privilege/Auth.java: ########## @@ -1407,6 +1408,58 @@ private void getUserAuthInfo(List<List<String>> userAuthInfos, UserIdentity user userAuthInfos.add(userAuthInfo); } + public static boolean isAdminPriv(GlobalPrivTable userGlobalPrivTable) { + PrivBitSet globalPrivs = new PrivBitSet(); + for (PrivEntry pe : userGlobalPrivTable.getEntries()) { + globalPrivs.or(pe.privSet); + } + if (globalPrivs.satisfy(PrivPredicate.ADMIN)) { + return true; + } + return false; + } + + public void getUserRoleWorkloadGroupPrivs(List<List<String>> result, UserIdentity currentUserIdentity) { + readLock(); + try { + boolean isCurrentUserAdmin = isAdminPriv(getUserGlobalPrivTable(currentUserIdentity)); Review Comment: Can `checkGlobalPriv (current UserIdentity, PrivPredicte. ADMIN)` be used instead? ########## fe/fe-core/src/main/java/org/apache/doris/mysql/privilege/RoleManager.java: ########## @@ -211,6 +212,31 @@ public void getRoleInfo(List<List<String>> results) { } } + public void getRoleWorkloadGroupPrivs(List<List<String>> result, Set<String> limitedRole) { + for (Role role : roles.values()) { + if (ClusterNamespace.getNameFromFullName(role.getRoleName()).startsWith(DEFAULT_ROLE_PREFIX)) { + continue; + } + + if (limitedRole != null && !limitedRole.contains(role.getRoleName())) { + continue; + } + String isGrantable = Auth.isAdminPriv(role.getGlobalPrivTable()) ? "YES" : "NO"; Review Comment: role.checkGlobalPriv(wanted) instaed? -- 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...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org