wangbo commented on code in PR #20242:
URL: https://github.com/apache/doris/pull/20242#discussion_r1213079988


##########
fe/fe-core/src/main/java/org/apache/doris/mysql/privilege/Role.java:
##########
@@ -103,15 +117,24 @@ public Role(String roleName, ResourcePattern 
resourcePattern, PrivBitSet privs)
         grantPrivs(resourcePattern, privs.copy());
     }
 
+    public Role(String roleName, WorkloadGroupPattern workloadGroupPattern, 
PrivBitSet privs) throws DdlException {
+        this.roleName = roleName;
+        this.workloadGroupPatternToPrivs.put(workloadGroupPattern, privs);
+        grantPrivs(workloadGroupPattern, privs.copy());
+    }
+
     public Role(String roleName, TablePattern tablePattern, PrivBitSet 
tablePrivs,
-            ResourcePattern resourcePattern, PrivBitSet resourcePrivs) {
+            ResourcePattern resourcePattern, PrivBitSet resourcePrivs, 
WorkloadGroupPattern workloadGroupPattern,
+            PrivBitSet workloadGroupPrivs) {
         this.roleName = roleName;
         this.tblPatternToPrivs.put(tablePattern, tablePrivs);
         this.resourcePatternToPrivs.put(resourcePattern, resourcePrivs);
+        this.workloadGroupPatternToPrivs.put(workloadGroupPattern, 
workloadGroupPrivs);
         //for init admin role,will not generate exception
         try {
             grantPrivs(tablePattern, tablePrivs.copy());
             grantPrivs(resourcePattern, resourcePrivs.copy());
+            grantPrivs(workloadGroupPattern, workloadGroupPrivs);

Review Comment:
   Why not copy here? just like tablePrivs and resourcePrivs



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

Reply via email to