[fix](auth)fix not check udf auth in nereids (#25541)

This commit is contained in:
zhangdong
2023-10-18 16:22:36 +08:00
committed by GitHub
parent e4a83a22d1
commit 85e83b9c6c
2 changed files with 72 additions and 1 deletions

View File

@ -18,6 +18,7 @@
package org.apache.doris.catalog;
import org.apache.doris.cluster.ClusterNamespace;
import org.apache.doris.mysql.privilege.PrivPredicate;
import org.apache.doris.nereids.annotation.Developing;
import org.apache.doris.nereids.exceptions.AnalysisException;
import org.apache.doris.nereids.trees.expressions.functions.AggStateFunctionBuilder;
@ -132,7 +133,8 @@ public class FunctionRegistry {
if (ConnectContext.get() != null) {
dbName = ClusterNamespace.getFullName(ConnectContext.get().getClusterName(),
dbName == null ? ConnectContext.get().getDatabase() : dbName);
if (dbName == null) {
if (dbName == null || !Env.getCurrentEnv().getAccessManager()
.checkDbPriv(ConnectContext.get(), dbName, PrivPredicate.SELECT)) {
scopes = ImmutableList.of(GLOBAL_FUNCTION);
} else {
scopes = ImmutableList.of(dbName, GLOBAL_FUNCTION);