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;
16
16
use std:: sync:: Arc ;
17
17
18
18
use common_exception:: Result ;
19
- use common_legacy_planners:: PlanNode ;
20
19
21
20
use crate :: interpreters:: access:: PrivilegeAccess ;
22
21
use crate :: interpreters:: ManagementModeAccess ;
@@ -26,11 +25,7 @@ use crate::sql::plans::Plan;
26
25
#[ async_trait:: async_trait]
27
26
pub trait AccessChecker : Sync + Send {
28
27
// 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 < ( ) > ;
34
29
}
35
30
36
31
pub struct Accessor {
@@ -48,9 +43,9 @@ impl Accessor {
48
43
Accessor { accessors }
49
44
}
50
45
51
- pub async fn check_new ( & self , plan : & Plan ) -> Result < ( ) > {
46
+ pub async fn check ( & self , plan : & Plan ) -> Result < ( ) > {
52
47
for accessor in self . accessors . values ( ) {
53
- accessor. check_new ( plan) . await ?;
48
+ accessor. check ( plan) . await ?;
54
49
}
55
50
Ok ( ( ) )
56
51
}
Original file line number Diff line number Diff line change @@ -16,7 +16,6 @@ use std::sync::Arc;
16
16
17
17
use common_exception:: ErrorCode ;
18
18
use common_exception:: Result ;
19
- use common_legacy_planners:: PlanNode ;
20
19
21
20
use crate :: interpreters:: access:: AccessChecker ;
22
21
use crate :: sessions:: QueryContext ;
@@ -36,22 +35,7 @@ impl ManagementModeAccess {
36
35
#[ async_trait:: async_trait]
37
36
impl AccessChecker for ManagementModeAccess {
38
37
// 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 < ( ) > {
55
39
// Allows for management-mode.
56
40
if self . ctx . get_config ( ) . query . management_mode {
57
41
let ok = match plan {
Original file line number Diff line number Diff line change 15
15
use std:: sync:: Arc ;
16
16
17
17
use common_exception:: Result ;
18
- use common_legacy_planners:: PlanNode ;
19
18
use common_meta_types:: GrantObject ;
20
19
use common_meta_types:: UserPrivilegeType ;
21
20
@@ -35,12 +34,7 @@ impl PrivilegeAccess {
35
34
36
35
#[ async_trait:: async_trait]
37
36
impl 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 < ( ) > {
44
38
let session = self . ctx . get_current_session ( ) ;
45
39
46
40
match plan {
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ impl InterpreterFactoryV2 {
47
47
pub async fn get ( ctx : Arc < QueryContext > , plan : & Plan ) -> Result < InterpreterPtr > {
48
48
// Check the access permission.
49
49
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| {
51
51
error ! ( "Access.denied(v2): {:?}" , e) ;
52
52
e
53
53
} ) ?;
You can’t perform that action at this time.
0 commit comments