benjreinhart opened a new pull request #13878:
URL: https://github.com/apache/superset/pull/13878


   ### SUMMARY
   
   This fixes #13378 by ensuring that Flask's global object `g` contains a 
`user` object set to the user who initiated the request when queries are 
executing asynchronously. There is currently some deeply buried code that 
expects this when constructing the query. This is not a particularly robust 
fix, so if anyone has any suggestions I'd be very interested in hearing them. 
Ideally, we'd have a way to explicitly pass the username to where it's needed 
for impersonation configuration (like SQL lab does), but this would require a 
substantial amount of changes as far as I can tell. Even if refactoring that is 
the goal, I think we should get this out to unblock folks first.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   <!--- Skip this if not applicable -->
   
   ### TEST PLAN
   
   This is difficult to test well, so the unit tests were updated to ensure a 
function is called that I manually tested. This is not a great test, and I 
almost omitted it altogether, but ended up including it. Let me know if you 
have suggestions.
   
   Additionally, I would like to test this end-to-end but I don't have that 
environment setup yet. I'm going to work to get this set up. In the meantime, 
@juneauwang and @gorcurek if you're able to pull this branch down and test it, 
that would be lovely.
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [X] Has associated issue:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to