Skip to content

[FIX] queue_job: repoint default_env to SUPERUSER in runjob#923

Open
dannyadair wants to merge 1 commit intoOCA:19.0from
dannyadair:19.0-fix-runjob-env-user
Open

[FIX] queue_job: repoint default_env to SUPERUSER in runjob#923
dannyadair wants to merge 1 commit intoOCA:19.0from
dannyadair:19.0-fix-runjob-env-user

Conversation

@dannyadair
Copy link
Copy Markdown

runjob is declared auth="none", so _auth_method_none pins request.env and transaction.default_env to a uid=None env. env = http.request.env( user=SUPERUSER_ID) only creates a local superuser env, leaving the default_env as uid=None. Any flush that goes through Transaction.flush() -> default_env.flush_all() then recomputes stored fields as uid=None and fails on anything dereferencing self.env.user.

http.request.update_env(user=SUPERUSER_ID) additionally sets transaction.default_env to the superuser env.

Closes #922

runjob is declared auth="none", so _auth_method_none pins request.env
and transaction.default_env to a uid=None env. `env = http.request.env(
user=SUPERUSER_ID)` only creates a local superuser env, leaving the
default_env as uid=None. Any flush that goes through
Transaction.flush() -> default_env.flush_all() then recomputes stored
fields as uid=None and fails on anything dereferencing self.env.user.

`http.request.update_env(user=SUPERUSER_ID)` additionally sets
transaction.default_env to the superuser env.

Closes OCA#922
@OCA-git-bot
Copy link
Copy Markdown
Contributor

Hi @guewen, @sbidoul,
some modules you are maintaining are being modified, check this out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants