This is an automated email from the ASF dual-hosted git repository.

morningman pushed a commit to branch branch-1.1-lts
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-1.1-lts by this push:
     new cc7160ecc1 [fix] 'SHOW ROLES' statement does not display global 
resource privilege in branch-1.1-lts (#14905) (#14908)
cc7160ecc1 is described below

commit cc7160ecc14c9fe77210ce08d84146d288b6c030
Author: xu tao <xutao_u...@163.com>
AuthorDate: Wed Dec 7 23:00:12 2022 +0800

    [fix] 'SHOW ROLES' statement does not display global resource privilege in 
branch-1.1-lts (#14905) (#14908)
---
 .../org/apache/doris/mysql/privilege/RoleManager.java     | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/mysql/privilege/RoleManager.java 
b/fe/fe-core/src/main/java/org/apache/doris/mysql/privilege/RoleManager.java
index ab486b42e5..54713309c2 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/mysql/privilege/RoleManager.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/mysql/privilege/RoleManager.java
@@ -134,16 +134,29 @@ public class RoleManager implements Writable {
             
             // global
             boolean hasGlobal = false;
+            PrivBitSet privBitSet = PrivBitSet.of();
             for (Map.Entry<TablePattern, PrivBitSet> entry : 
role.getTblPatternToPrivs().entrySet()) {
                 if (entry.getKey().getPrivLevel() == PrivLevel.GLOBAL) {
                     hasGlobal = true;
-                    info.add(entry.getValue().toString());
+                    privBitSet.or(entry.getValue());
                     // global priv should only has one
                     break;
                 }
             }
+
+            for (Map.Entry<ResourcePattern, PrivBitSet> entry : 
role.getResourcePatternToPrivs().entrySet()) {
+                if (entry.getKey().getPrivLevel() == PrivLevel.GLOBAL) {
+                    hasGlobal = true;
+                    privBitSet.or(entry.getValue());
+                    // global priv should only has one
+                    break;
+                }
+            }
+
             if (!hasGlobal) {
                 info.add(FeConstants.null_string);
+            } else {
+                info.add(privBitSet.toString());
             }
 
             // db


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to