[18.0][FIX] base_remote: allow RPC authentication without HTTP context#3612
Open
fsmw wants to merge 2 commits into
Open
[18.0][FIX] base_remote: allow RPC authentication without HTTP context#3612fsmw wants to merge 2 commits into
fsmw wants to merge 2 commits into
Conversation
…ilure Odoo 18 exp_authenticate() requires 4 arguments (db, login, password, user_agent_env). The previous commit removed the empty dict, causing TypeError in CI.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3458
When authenticating via RPC (XML-RPC, JSON-RPC), there is no active
HTTP request context. The
Base.remoteproperty returns an emptyres.remoterecordset in this case.However,
ResUsers._auth_check_remoteunconditionally calledensure_one()on that recordset, causing:This blocked all API/RPC authentication while web login continued
to work normally.
Fix: Add
and remoteto the guard beforeensure_one(),skipping the singleton check when the remote recordset is empty.
This matches the existing pattern used for
config['test_enable']and does not affect web authentication where an HTTP context exists.
Tests:
test_auth_check_remote_no_http_contextwhich patchesBase.remoteto return an empty recordset and verifies that_auth_check_remotetolerates it without crashing.Backward compatible: existing behaviour for browser sessions is
unchanged.