-
-
Notifications
You must be signed in to change notification settings - Fork 438
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: apply no_user_creation for AccessDenied
- Loading branch information
Showing
1 changed file
with
5 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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
a8955ff
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can not work anymore in version 18.0 as we see:
2025-02-04 14:35:37,065 29586 INFO auth_oauth_multi_token_1 odoo.addons.auth_oauth_multi_token.tests.test_multi_token: Starting TestMultiToken.test_no_provider_no_access ...
2025-02-04 14:35:37,081 29586 INFO auth_oauth_multi_token_1 odoo.addons.auth_oauth_multi_token.tests.test_multi_token: ======================================================================
2025-02-04 14:35:37,081 29586 ERROR auth_oauth_multi_token_1 odoo.addons.auth_oauth_multi_token.tests.test_multi_token: ERROR: TestMultiToken.test_no_provider_no_access
Traceback (most recent call last):
File "/home/kobros/Workspace/odoo18/odoo/addons/auth_oauth/models/res_users.py", line 104, in _auth_oauth_signin
raise AccessDenied()
odoo.exceptions.AccessDenied: Access Denied
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/kobros/Workspace/odoo18/server-auth/auth_oauth_multi_token/tests/test_multi_token.py", line 43, in test_no_provider_no_access
self.user_model._auth_oauth_signin(
File "/home/kobros/Workspace/odoo18/server-auth/auth_oauth_multi_token/models/res_users.py", line 45, in _auth_oauth_signin
res = super()._auth_oauth_signin(provider, validation, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/kobros/Workspace/odoo18/odoo/addons/auth_oauth/models/res_users.py", line 115, in _auth_oauth_signin
login, _ = self.signup(values, token)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/kobros/Workspace/odoo18/odoo/addons/auth_signup/models/res_users.py", line 67, in signup
partner = self.env['res.partner']._signup_retrieve_partner(token, check_validity=True, raise_exception=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/kobros/Workspace/odoo18/odoo/addons/auth_signup/models/res_partner.py", line 128, in _signup_retrieve_partner
partner = self._get_partner_from_token(token)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/kobros/Workspace/odoo18/odoo/addons/auth_signup/models/res_partner.py", line 182, in _get_partner_from_token
if payload := tools.verify_hash_signed(self.sudo().env, 'signup', token):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/kobros/Workspace/odoo18/odoo/odoo/tools/misc.py", line 1821, in verify_hash_signed
raise ValueError('Unknown token version')
ValueError: Unknown token version
2025-02-04 14:35:37,082 29586 INFO auth_oauth_multi_token_1 odoo.addons.auth_oauth_multi_token.tests.test_multi_token: Starting TestMultiToken.test_remove_oauth_access_token ...
2025-02-04 14:35:37,170 29586 INFO auth_oauth_multi_token_1 odoo.addons.base.models.ir_attachment: filestore gc 63 checked, 1 removed
2025-02-04 14:35:37,192 29586 INFO auth_oauth_multi_token_1 odoo.modules.loading: Module auth_oauth_multi_token loaded in 1.06s (incl. 0.46s test), 134 queries (+190 test, +134 other)
2025-02-04 14:35:37,192 29586 ERROR auth_oauth_multi_token_1 odoo.modules.loading: Module auth_oauth_multi_token: 0 failures, 1 errors of 5 tests
2025-02-04 14:35:37,193 29586 INFO auth_oauth_multi_token_1 odoo.modules.loading: 26 modules loaded in 24.70s, 13458 queries (+13649 extra)
2025-02-04 14:35:37,957 29586 ERROR auth_oauth_multi_token_1 odoo.modules.loading: At least one test failed when loading the modules.
2025-02-04 14:35:37,970 29586 INFO auth_oauth_multi_token_1 odoo.modules.registry: Registry changed, signaling through the database
2025-02-04 14:35:37,972 29586 INFO auth_oauth_multi_token_1 odoo.modules.registry: Registry loaded in 48.054s
a8955ff
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure I understand. AccessDenied is the error you need to raise to pass the test. is expected.
a8955ff
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes it is but because the token was not written in the new version another exception was raised.
Now I updated the looking of the token and access denied is rising