Ensure session auth data is passed to executor options

This commit is contained in:
Tobie Morgan Hitchcock 2022-02-18 02:02:12 +00:00
parent 691d6ac895
commit 8a08de951e

View file

@ -28,6 +28,7 @@ pub async fn execute(
// Parse the SQL query text // Parse the SQL query text
let ast = sql::parse(txt)?; let ast = sql::parse(txt)?;
// Process all statements // Process all statements
opt.auth = Arc::new(session.au);
opt.ns = session.ns.map(Arc::new); opt.ns = session.ns.map(Arc::new);
opt.db = session.db.map(Arc::new); opt.db = session.db.map(Arc::new);
exe.execute(ctx, opt, ast).await exe.execute(ctx, opt, ast).await
@ -48,6 +49,7 @@ pub async fn process(
// Attach the defined variables // Attach the defined variables
let ctx = vars.attach(ctx); let ctx = vars.attach(ctx);
// Process all statements // Process all statements
opt.auth = Arc::new(session.au);
opt.ns = session.ns.map(Arc::new); opt.ns = session.ns.map(Arc::new);
opt.db = session.db.map(Arc::new); opt.db = session.db.map(Arc::new);
exe.execute(ctx, opt, ast).await exe.execute(ctx, opt, ast).await
@ -61,6 +63,7 @@ pub async fn export(db: Store, session: Session, sender: Sender) -> Result<(), E
// Create a new execution context // Create a new execution context
let ctx = session.context(); let ctx = session.context();
// Process database export // Process database export
opt.auth = Arc::new(session.au);
opt.ns = session.ns.map(Arc::new); opt.ns = session.ns.map(Arc::new);
opt.db = session.db.map(Arc::new); opt.db = session.db.map(Arc::new);
exe.export(ctx, opt, sender).await exe.export(ctx, opt, sender).await