[fix](priv) fix bug of grant priv on ctl.db.* not work (#17612)

currently, when use grant xxx_priv on ctl.db.* to user_a, it does not work. When user_a switch to ctl,
he cannot see or use any database.
This commit is contained in:
Yulei-Yang
2023-03-11 22:27:26 +08:00
committed by GitHub
parent 692d510edb
commit 9745ee60a7

View File

@ -17,6 +17,9 @@
package org.apache.doris.mysql.privilege;
import org.apache.doris.cluster.ClusterNamespace;
import org.apache.doris.system.SystemInfoService;
import com.google.common.base.Preconditions;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -42,7 +45,9 @@ public class DbPrivTable extends PrivTable {
}
// check db
if (!dbPrivEntry.isAnyDb() && !dbPrivEntry.getDbPattern().match(db)) {
// dbPrivEntry.getDbPattern() is always constructed by string as of form: 'default_cluster:xxx_db'
if (!dbPrivEntry.isAnyDb() && !dbPrivEntry.getDbPattern().match(db) && !dbPrivEntry.getDbPattern()
.match(ClusterNamespace.getFullName(SystemInfoService.DEFAULT_CLUSTER, db))) {
continue;
}