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


##########
fe/fe-core/src/main/java/org/apache/doris/resource/workloadgroup/WorkloadGroupMgr.java:
##########
@@ -133,6 +135,19 @@ public QueryQueue getWorkloadGroupQueryQueue(String 
groupName) throws UserExcept
         }
     }
 
+    private String getWorkloadGroupName(ConnectContext context) throws 
AnalysisException {
+        String groupName = context.getSessionVariable().getWorkloadGroup();
+        if (Strings.isNullOrEmpty(groupName)) {
+            groupName = 
Env.getCurrentEnv().getAuth().getWorkloadGroup(context.getQualifiedUser());
+        }
+        if 
(!Env.getCurrentEnv().getAccessManager().checkWorkloadGroupPriv(context, 
groupName, PrivPredicate.USAGE)) {
+            ErrorReport.reportAnalysisException(
+                    "Access denied; you need (at least one of) the %s 
privilege(s) to use workload group '%s'.",

Review Comment:
   Should we check permissions when `setWorkloadGroup` in session?



##########
fe/fe-core/src/main/java/org/apache/doris/resource/workloadgroup/WorkloadGroupMgr.java:
##########
@@ -133,6 +135,19 @@ public QueryQueue getWorkloadGroupQueryQueue(String 
groupName) throws UserExcept
         }
     }
 
+    private String getWorkloadGroupName(ConnectContext context) throws 
AnalysisException {
+        String groupName = context.getSessionVariable().getWorkloadGroup();
+        if (Strings.isNullOrEmpty(groupName)) {
+            groupName = 
Env.getCurrentEnv().getAuth().getWorkloadGroup(context.getQualifiedUser());
+        }
+        if 
(!Env.getCurrentEnv().getAccessManager().checkWorkloadGroupPriv(context, 
groupName, PrivPredicate.USAGE)) {

Review Comment:
   If `groupName` is still null, set it to null?



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to