File tree Expand file tree Collapse file tree 4 files changed +6
-33
lines changed
src/query/service/src/interpreters Expand file tree Collapse file tree 4 files changed +6
-33
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,6 @@ use std::collections::HashMap;
1616use std:: sync:: Arc ;
1717
1818use common_exception:: Result ;
19- use common_legacy_planners:: PlanNode ;
2019
2120use crate :: interpreters:: access:: PrivilegeAccess ;
2221use crate :: interpreters:: ManagementModeAccess ;
@@ -26,11 +25,7 @@ use crate::sql::plans::Plan;
2625#[ async_trait:: async_trait]
2726pub trait AccessChecker : Sync + Send {
2827 // Check the access permission for the old plan.
29- // TODO(bohu): Remove after new plan done.
30- async fn check ( & self , plan : & PlanNode ) -> Result < ( ) > ;
31-
32- // Check the access permission for the old plan.
33- async fn check_new ( & self , _plan : & Plan ) -> Result < ( ) > ;
28+ async fn check ( & self , _plan : & Plan ) -> Result < ( ) > ;
3429}
3530
3631pub struct Accessor {
@@ -48,9 +43,9 @@ impl Accessor {
4843 Accessor { accessors }
4944 }
5045
51- pub async fn check_new ( & self , plan : & Plan ) -> Result < ( ) > {
46+ pub async fn check ( & self , plan : & Plan ) -> Result < ( ) > {
5247 for accessor in self . accessors . values ( ) {
53- accessor. check_new ( plan) . await ?;
48+ accessor. check ( plan) . await ?;
5449 }
5550 Ok ( ( ) )
5651 }
Original file line number Diff line number Diff line change @@ -16,7 +16,6 @@ use std::sync::Arc;
1616
1717use common_exception:: ErrorCode ;
1818use common_exception:: Result ;
19- use common_legacy_planners:: PlanNode ;
2019
2120use crate :: interpreters:: access:: AccessChecker ;
2221use crate :: sessions:: QueryContext ;
@@ -36,22 +35,7 @@ impl ManagementModeAccess {
3635#[ async_trait:: async_trait]
3736impl AccessChecker for ManagementModeAccess {
3837 // Check what we can do if in management mode.
39- async fn check ( & self , plan : & PlanNode ) -> Result < ( ) > {
40- // Allows for management-mode.
41- if self . ctx . get_config ( ) . query . management_mode {
42- return match plan {
43- PlanNode :: Empty ( _) => Ok ( ( ) ) ,
44- _ => Err ( ErrorCode :: ManagementModePermissionDenied ( format ! (
45- "Access denied for operation:{:?} in management-mode" ,
46- plan. name( )
47- ) ) ) ,
48- } ;
49- } ;
50- Ok ( ( ) )
51- }
52-
53- // Check what we can do if in management mode.
54- async fn check_new ( & self , plan : & Plan ) -> Result < ( ) > {
38+ async fn check ( & self , plan : & Plan ) -> Result < ( ) > {
5539 // Allows for management-mode.
5640 if self . ctx . get_config ( ) . query . management_mode {
5741 let ok = match plan {
Original file line number Diff line number Diff line change 1515use std:: sync:: Arc ;
1616
1717use common_exception:: Result ;
18- use common_legacy_planners:: PlanNode ;
1918use common_meta_types:: GrantObject ;
2019use common_meta_types:: UserPrivilegeType ;
2120
@@ -35,12 +34,7 @@ impl PrivilegeAccess {
3534
3635#[ async_trait:: async_trait]
3736impl AccessChecker for PrivilegeAccess {
38- async fn check ( & self , _plan : & PlanNode ) -> Result < ( ) > {
39- // The old planner *NO* need to check anymore.
40- Ok ( ( ) )
41- }
42-
43- async fn check_new ( & self , plan : & Plan ) -> Result < ( ) > {
37+ async fn check ( & self , plan : & Plan ) -> Result < ( ) > {
4438 let session = self . ctx . get_current_session ( ) ;
4539
4640 match plan {
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ impl InterpreterFactoryV2 {
4747 pub async fn get ( ctx : Arc < QueryContext > , plan : & Plan ) -> Result < InterpreterPtr > {
4848 // Check the access permission.
4949 let access_checker = Accessor :: create ( ctx. clone ( ) ) ;
50- access_checker. check_new ( plan) . await . map_err ( |e| {
50+ access_checker. check ( plan) . await . map_err ( |e| {
5151 error ! ( "Access.denied(v2): {:?}" , e) ;
5252 e
5353 } ) ?;
You can’t perform that action at this time.
0 commit comments