diff --git a/src/query/service/src/interpreters/access/privilege_access.rs b/src/query/service/src/interpreters/access/privilege_access.rs index 53eea5ef639ef..b4b4cd82e1f18 100644 --- a/src/query/service/src/interpreters/access/privilege_access.rs +++ b/src/query/service/src/interpreters/access/privilege_access.rs @@ -17,11 +17,9 @@ use std::sync::Arc; use common_exception::Result; use common_meta_app::principal::GrantObject; use common_meta_app::principal::UserPrivilegeType; -use common_sql::TableEntry; use crate::interpreters::access::AccessChecker; use crate::sessions::QueryContext; -use crate::sessions::Session; use crate::sql::plans::Plan; pub struct PrivilegeAccess { @@ -34,19 +32,6 @@ impl PrivilegeAccess { } } -async fn validate_query_privilege(session: &Arc, table: &&TableEntry) -> Result<()> { - session - .validate_privilege( - &GrantObject::Table( - table.catalog().to_string(), - table.database().to_string(), - table.name().to_string(), - ), - UserPrivilegeType::Select, - ) - .await -} - #[async_trait::async_trait] impl AccessChecker for PrivilegeAccess { async fn check(&self, plan: &Plan) -> Result<()> { @@ -59,7 +44,16 @@ impl AccessChecker for PrivilegeAccess { if table.is_source_of_view() { continue; } - validate_query_privilege(&session, &table).await?; + session + .validate_privilege( + &GrantObject::Table( + table.catalog().to_string(), + table.database().to_string(), + table.name().to_string(), + ), + UserPrivilegeType::Select, + ) + .await? } } Plan::Explain { .. } => {}