pick: https://github.com/apache/doris/pull/39747
This commit is contained in:
@ -17,6 +17,7 @@
|
||||
|
||||
package org.apache.doris.qe;
|
||||
|
||||
import org.apache.doris.analysis.UserIdentity;
|
||||
import org.apache.doris.catalog.Env;
|
||||
import org.apache.doris.common.ThreadPoolManager;
|
||||
import org.apache.doris.common.util.DebugUtil;
|
||||
@ -173,10 +174,17 @@ public class ConnectScheduler {
|
||||
}
|
||||
|
||||
// used for thrift
|
||||
public List<List<String>> listConnectionWithoutAuth(boolean isShowFullSql, boolean isShowFeHost) {
|
||||
public List<List<String>> listConnectionForRpc(UserIdentity userIdentity, boolean isShowFullSql,
|
||||
boolean isShowFeHost) {
|
||||
List<List<String>> list = new ArrayList<>();
|
||||
long nowMs = System.currentTimeMillis();
|
||||
for (ConnectContext ctx : connectionMap.values()) {
|
||||
// Check auth
|
||||
if (!ctx.getCurrentUserIdentity().equals(userIdentity) && !Env.getCurrentEnv()
|
||||
.getAccessManager()
|
||||
.checkGlobalPriv(userIdentity, PrivPredicate.GRANT)) {
|
||||
continue;
|
||||
}
|
||||
list.add(ctx.toThreadInfo(isShowFullSql).toRow(-1, nowMs, isShowFeHost));
|
||||
}
|
||||
return list;
|
||||
|
||||
@ -483,6 +483,7 @@ public class ShowExecutor {
|
||||
try {
|
||||
TShowProcessListRequest request = new TShowProcessListRequest();
|
||||
request.setShowFullSql(isShowFullSql);
|
||||
request.setCurrentUserIdent(ConnectContext.get().getCurrentUserIdentity().toThrift());
|
||||
List<Pair<String, Integer>> frontends = FrontendsProcNode.getFrontendWithRpcPort(Env.getCurrentEnv(),
|
||||
false);
|
||||
FrontendService.Client client = null;
|
||||
|
||||
@ -4006,8 +4006,12 @@ public class FrontendServiceImpl implements FrontendService.Iface {
|
||||
if (request.isSetShowFullSql()) {
|
||||
isShowFullSql = request.isShowFullSql();
|
||||
}
|
||||
UserIdentity userIdentity = UserIdentity.ROOT;
|
||||
if (request.isSetCurrentUserIdent()) {
|
||||
userIdentity = UserIdentity.fromThrift(request.getCurrentUserIdent());
|
||||
}
|
||||
List<List<String>> processList = ExecuteEnv.getInstance().getScheduler()
|
||||
.listConnectionWithoutAuth(isShowFullSql, true);
|
||||
.listConnectionForRpc(userIdentity, isShowFullSql, true);
|
||||
TShowProcessListResult result = new TShowProcessListResult();
|
||||
result.setProcessList(processList);
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user