Skip to content

[18.0][FIX] webservice: reset oauth2_flow regardless of server_environment - #161

Open
simahawk wants to merge 1 commit into
OCA:18.0from
camptocamp:18.0-fix-oauth2-flow-reset
Open

[18.0][FIX] webservice: reset oauth2_flow regardless of server_environment#161
simahawk wants to merge 1 commit into
OCA:18.0from
camptocamp:18.0-fix-oauth2-flow-reset

Conversation

@simahawk

Copy link
Copy Markdown
Contributor

#146 split server_environment out of webservice into the optional webservice_server_env module, but the logic resetting oauth2_flow when auth_type is no longer "oauth2" only lived in webservice_server_env's _compute_server_env override.

Without server_environment installed, switching a backend's auth_type away from "oauth2" (via the UI or a plain write) silently left a stale oauth2_flow, which _get_adapter_protocol would then still factor into the selected component.

Add an _onchange_auth_type plus create/write overrides on webservice.backend itself so the reset is guaranteed unconditionally, independent of server_environment. webservice_server_env's own override is unchanged and still covers its own case (env-var-driven values).

CC @yankinmax @gurneyalex

PR#146 split server_environment out of `webservice` into the optional
`webservice_server_env` module, but the logic resetting `oauth2_flow`
when `auth_type` is no longer "oauth2" only lived in
`webservice_server_env`'s `_compute_server_env` override.

Without `server_environment` installed, switching a backend's
`auth_type` away from "oauth2" (via the UI or a plain write) silently
left a stale `oauth2_flow`, which `_get_adapter_protocol` would then
still factor into the selected component.

Add an `_onchange_auth_type` plus `create`/`write` overrides on
`webservice.backend` itself so the reset is guaranteed unconditionally,
independent of `server_environment`. `webservice_server_env`'s own
override is unchanged and still covers its own case (env-var-driven
values).

@yankinmax yankinmax left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, thank you @simahawk
Just a question: will we FW and BKP this commit as a separate PR or do you want me just to include it in existing PR's splitting the server_environment?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants