File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -415,7 +415,8 @@ where
415415
416416 PROGRAM_EXEC_COUNT . increment ( 1 ) ;
417417
418- check_program_auth ( & ctx, & pgm, & self . inner . lock ( ) . config_store . get ( ) ) ?;
418+ let config = self . inner . lock ( ) . config_store . get ( ) ;
419+ check_program_auth ( & ctx, & pgm, & config) . await ?;
419420
420421 // create the bomb right before spawning the blocking task.
421422 let mut bomb = Bomb {
Original file line number Diff line number Diff line change @@ -341,7 +341,7 @@ fn value_size(val: &rusqlite::types::ValueRef) -> usize {
341341 }
342342}
343343
344- pub fn check_program_auth (
344+ pub async fn check_program_auth (
345345 ctx : & RequestContext ,
346346 pgm : & Program ,
347347 config : & DatabaseConfig ,
@@ -363,15 +363,11 @@ pub fn check_program_auth(
363363 }
364364 StmtKind :: Attach ( ref ns) => {
365365 ctx. auth . has_right ( ns, Permission :: AttachRead ) ?;
366- return tokio:: runtime:: Handle :: current ( ) . block_on ( async {
367- if !ctx. meta_store . handle ( ns. clone ( ) ) . await . get ( ) . allow_attach {
368- return Err ( Error :: NotAuthorized ( format ! (
369- "Namespace `{ns}` doesn't allow attach"
370- ) ) ) ;
371- } else {
372- Ok ( ( ) )
373- }
374- } ) ;
366+ if !ctx. meta_store . handle ( ns. clone ( ) ) . await . get ( ) . allow_attach {
367+ return Err ( Error :: NotAuthorized ( format ! (
368+ "Namespace `{ns}` doesn't allow attach"
369+ ) ) ) ;
370+ }
375371 }
376372 StmtKind :: Detach => ( ) ,
377373 }
Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ impl crate::connection::Connection for SchemaConnection {
5050
5151 res
5252 } else {
53- check_program_auth ( & ctx, & migration, & self . config . get ( ) ) ?;
53+ check_program_auth ( & ctx, & migration, & self . config . get ( ) ) . await ?;
5454 let connection = self . connection . clone ( ) ;
5555 validate_migration ( & mut migration) ?;
5656 let migration = Arc :: new ( migration) ;
You can’t perform that action at this time.
0 commit comments