Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syncing from upstream OCA/server-auth (18.0) #553

Merged
merged 45 commits into from
Mar 4, 2025
Merged

Conversation

bt-admin
Copy link

@bt-admin bt-admin commented Mar 4, 2025

bt_gitbot

pedrobaeza and others added 30 commits October 17, 2024 09:45
… True * Add Usage section to ReadMe w/ Runbot link * `_crypt_context` now directly exposes the `CryptContext` * Change all instances of openerp to odoo * Add test coverage to IrConfigParameter * Add test coverage for res.users * Remove db from `get_session_parameters` method call * Remove deprecated skiparg for ormcache * Fix tests & lint * Switch cache to use self.cr.dbname * Fix ormcache
* Module auth_session_timeout:
---------------------------

* Refactor to allow other modules to inherit and augment or override the following:
** Session expiry time (deadline) calculation
** Ignored URLs
** Final session expiry (with possibility to late-abort)
* Re-ordered functionality to remove unnecessary work, as this code is called very often.
* Do not expire a session if delay gets set to zero (or unset / false)

* WIP

* Fixed flake8 lint errors

* Fixed flake8 lint errors

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* Module: auth-session-timeout: Refactor ResUser tests to use `unittest.mock` patching

* Module: auth_session_timeout: Fixed flake8 lint errors

* Module: auth_session_timeout: Fixed flake8 lint errors
…e backwards compatibility methods that were retained during v9 rework * Upgrade API and rename a few things for PEP-8 * Switch to HttpCase for tests * Switch to isolated build
… (#1070)

* corrects AttributeError: 'HttpRequest' object has no attribute 'http'

* updates the module version number for pull request #1070
New changes for move module, clean module, apply new oca guideline and make
compatible with 11.0:

* Move module from oca/server-tools:10.0  to oca/server-auth:11.0
* Remove .DS_Store files, addd by mistake in early changes and not needed.
* Fix error when make RPC request. Applied thanks to comment added by @christophlsa. For more information go to OCA/server-tools#1163 (review)
* Update version to the first one in 11.0
* Update README to match new guideline
* Remove she bang coding
* Use _authenticate method instead of deprecated method check. For more information go to https://github.com/odoo/odoo/blob/11.0/odoo/http.py#L1049
* Improve auth_session_timeout method return raise SessionExpiredException exception instead of False. This will show a "session expired please reload page" message to the user.
* Fix update unitet test. make then turn green and the update then to make them match with new changes

  - There was not getmtime() result definied in this test case, For that reason was returning a MagicMock() object, For this case their are trying to test that the session is valid, this is the same that the path of the file with session is not expired. To simulate that I just updated for the test case the getmtime() result to a value that will be greater than the delay expected: I used the current time This way when evaluationg if the sessions is expire will return False instead of TypeError: unorderable types: MagicMock() < float() The unit test still works the same and the result is without errors.

* Fix plylint errors:

  - E302 expected 2 blank lines,
  - Not used variable and not valid var name. Remove e varaible since is not valid name and this one is not been used.
Currently translated at 100.0% (3 of 3 strings)

Translation: server-auth-12.0/server-auth-12.0-auth_session_timeout
Translate-URL: https://translation.odoo-community.org/projects/server-auth-12-0/server-auth-12-0-auth_session_timeout/pt_BR/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: server-auth-13.0/server-auth-13.0-auth_session_timeout
Translate-URL: https://translation.odoo-community.org/projects/server-auth-13-0/server-auth-13-0-auth_session_timeout/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: server-auth-13.0/server-auth-13.0-auth_session_timeout
Translate-URL: https://translation.odoo-community.org/projects/server-auth-13-0/server-auth-13-0-auth_session_timeout/
Make it so session timeout doe not apply to requests
to a route with auth_method="public".

Forward port of #258
Currently translated at 100.0% (3 of 3 strings)

Translation: server-auth-14.0/server-auth-14.0-auth_session_timeout
Translate-URL: https://translation.odoo-community.org/projects/server-auth-14-0/server-auth-14-0-auth_session_timeout/pt_BR/
Currently translated at 100.0% (3 of 3 strings)

Translation: server-auth-15.0/server-auth-15.0-auth_session_timeout
Translate-URL: https://translation.odoo-community.org/projects/server-auth-15-0/server-auth-15-0-auth_session_timeout/ca/
Currently translated at 100.0% (3 of 3 strings)

Translation: server-auth-15.0/server-auth-15.0-auth_session_timeout
Translate-URL: https://translation.odoo-community.org/projects/server-auth-15-0/server-auth-15-0-auth_session_timeout/it/
Currently translated at 100.0% (3 of 3 strings)

Translation: server-auth-15.0/server-auth-15.0-auth_session_timeout
Translate-URL: https://translation.odoo-community.org/projects/server-auth-15-0/server-auth-15-0-auth_session_timeout/it/
…, but /web is a public route, so it does not trigger the session check but it does trigger session save, so the file mtime is updated before the second HTTP call makes the check takes place, and session is not expired
weblate and others added 15 commits October 17, 2024 09:45
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: server-auth-16.0/server-auth-16.0-auth_session_timeout
Translate-URL: https://translation.odoo-community.org/projects/server-auth-16-0/server-auth-16-0-auth_session_timeout/
Currently translated at 100.0% (3 of 3 strings)

Translation: server-auth-16.0/server-auth-16.0-auth_session_timeout
Translate-URL: https://translation.odoo-community.org/projects/server-auth-16-0/server-auth-16-0-auth_session_timeout/es/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: server-auth-16.0/server-auth-16.0-auth_session_timeout
Translate-URL: https://translation.odoo-community.org/projects/server-auth-16-0/server-auth-16-0-auth_session_timeout/
Currently translated at 100.0% (3 of 3 strings)

Translation: server-auth-16.0/server-auth-16.0-auth_session_timeout
Translate-URL: https://translation.odoo-community.org/projects/server-auth-16-0/server-auth-16-0-auth_session_timeout/es/
Currently translated at 100.0% (3 of 3 strings)

Translation: server-auth-16.0/server-auth-16.0-auth_session_timeout
Translate-URL: https://translation.odoo-community.org/projects/server-auth-16-0/server-auth-16-0-auth_session_timeout/it/
Currently translated at 100.0% (3 of 3 strings)

Translation: server-auth-16.0/server-auth-16.0-auth_session_timeout
Translate-URL: https://translation.odoo-community.org/projects/server-auth-16-0/server-auth-16-0-auth_session_timeout/ca/
Signed-off-by sebalix
@bt-admin bt-admin added the 18.0 label Mar 4, 2025
@bt-admin bt-admin merged commit 70db158 into brain-tec:18.0 Mar 4, 2025
4 checks passed
Copy link

codecov bot commented Mar 4, 2025

Codecov Report

Attention: Patch coverage is 95.56650% with 9 lines in your changes missing coverage. Please review.

Project coverage is 93.62%. Comparing base (7d42996) to head (ab12e8e).
Report is 57 commits behind head on 18.0.

Files with missing lines Patch % Lines
auth_session_timeout/models/res_users.py 82.69% 4 Missing and 5 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             18.0     #553      +/-   ##
==========================================
+ Coverage   93.35%   93.62%   +0.26%     
==========================================
  Files          60       68       +8     
  Lines        1506     1709     +203     
  Branches      111      122      +11     
==========================================
+ Hits         1406     1600     +194     
- Misses         58       62       +4     
- Partials       42       47       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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.