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

[16.0][mig] auth_session_timeout: Migration to 16.0 #524

Closed
wants to merge 38 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
c06c0bb
inactive_session_timeout > auth_session_timeout
pedrobaeza Aug 29, 2016
7a0e6c5
auth_session_timeout: References to old name
pedrobaeza Aug 29, 2016
4a83155
Make modules uninstallable
pedrobaeza Oct 6, 2016
fdcc14b
Rename manifest files
pedrobaeza Oct 6, 2016
79cb596
auth_session_timeout: Migrate to v10 * Bump versions * Installable to…
lasley Oct 21, 2016
53c20c1
Module auth_session_timeout: Pluggability (#887)
jmorgannz Sep 6, 2017
758cb5d
auth_session_timeout: Deprecate backwards compat + improve * Deprecat…
lasley Nov 6, 2017
3698454
corrects AttributeError: 'HttpRequest' object has no attribute 'http'…
beenhere4hours Nov 29, 2017
628d95c
auth_session_timeout: Migration to 11.0
nadiaafa Feb 18, 2018
66e59fa
[MIG] auth_session_timeout: Migration to version 11.0
zaoral Jul 12, 2018
2e91e7b
OCA Transbot updated translations from Transifex
oca-transbot Sep 4, 2016
8c705d0
[UPD] README.rst
OCA-git-bot Jul 20, 2018
6117e35
[UPD] Update auth_session_timeout.pot
oca-travis Dec 12, 2018
a546b8c
[12.0][MIG] auth_session_timeout
Jun 6, 2019
f6cdb06
[UPD] README.rst
OCA-git-bot Aug 2, 2019
9e49540
Translated using Weblate (Portuguese (Brazil))
Sep 3, 2019
fdb6408
[MIG] auth_session_timeout: Migration to 13.0
rruebner Oct 1, 2019
bb90b78
[REF] pre-commit lint
dreispt Apr 1, 2020
11bcf98
[UPD] Update auth_session_timeout.pot
oca-travis Apr 2, 2020
b663d3e
[UPD] README.rst
OCA-git-bot Apr 2, 2020
ae33056
Update translation files
oca-transbot May 13, 2020
108c102
Update translation files
oca-transbot Aug 16, 2020
9672d87
[MIG] Module migrated in v14.
Chandresh-SerpentCS Feb 10, 2021
a19c33c
[UPD] README.rst
OCA-git-bot Mar 4, 2021
c5c68ea
[UPD] Update auth_session_timeout.pot
oca-travis Mar 4, 2021
c15e39c
[FIX] auth_session_timeout: session timeout applies only to user
pierre-halleux Mar 18, 2021
83cc9b5
auth_session_timeout 14.0.1.0.1
OCA-git-bot May 5, 2021
d8d8957
Translated using Weblate (Portuguese (Brazil))
Feb 1, 2022
c070cba
[IMP] auth_session_timeout: black, isort
flachica Mar 1, 2022
6070707
Standard migration
flachica Mar 1, 2022
96bb3c8
[UPD] Update auth_session_timeout.pot
Mar 22, 2022
19fa8ae
[UPD] README.rst
OCA-git-bot Mar 22, 2022
2e477d3
Translated using Weblate (Catalan)
Noel000 Apr 13, 2022
270476a
Translated using Weblate (Italian)
mymage Dec 28, 2022
3af7289
Translated using Weblate (Italian)
francesco-ooops Mar 7, 2023
c744f2a
[IMP] auth_session_timeout: pre-commit stuff
dsolanki-initos Apr 18, 2023
565492b
[MIG] auth_session_timeout: Migration to 16.0
dsolanki-initos Apr 18, 2023
b83b70d
Merge branch '16.0' into 16.0-mig-auth_session_timeout
dsolanki-initos Jul 3, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ addon | version | maintainers | summary
[auth_api_key](auth_api_key/) | 16.0.1.0.0 | | Authenticate http requests from an API key
[auth_ldaps](auth_ldaps/) | 16.0.1.0.0 | | Allows to use LDAP over SSL authentication
[auth_saml](auth_saml/) | 16.0.1.0.0 | | SAML2 Authentication
[auth_session_timeout](auth_session_timeout/) | 16.0.1.0.0 | | This module disable all inactive sessions since a given delay
Copy link
Contributor

Choose a reason for hiding this comment

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

This causes the PR to have a conflict


[//]: # (end addons)

Expand Down
5 changes: 3 additions & 2 deletions auth_session_timeout/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Inactive Sessions Timeout
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--auth-lightgray.png?logo=github
:target: https://github.com/OCA/server-auth/tree/15.0/auth_session_timeout
:target: https://github.com/OCA/server-auth/tree/16.0/auth_session_timeout
:alt: OCA/server-auth
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/server-auth-15-0/server-auth-15-0-auth_session_timeout
Expand Down Expand Up @@ -82,6 +82,7 @@ Contributors
* Chandresh Thakkar <[email protected]>
* `Greenice <https://www.greenice.com>`_:
* Fernando La Chica <[email protected]>
* Dhara Solanki <[email protected]>

Maintainers
~~~~~~~~~~~
Expand All @@ -96,6 +97,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/server-auth <https://github.com/OCA/server-auth/tree/15.0/auth_session_timeout>`_ project on GitHub.
This module is part of the `OCA/server-auth <https://github.com/OCA/server-auth/tree/16.0/auth_session_timeout>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
8 changes: 6 additions & 2 deletions auth_session_timeout/models/ir_http.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import models
from odoo import http, models
from odoo.http import request


Expand All @@ -10,7 +10,11 @@ class IrHttp(models.AbstractModel):
@classmethod
def _authenticate(cls, endpoint):
res = super(IrHttp, cls)._authenticate(endpoint=endpoint)
auth_method = endpoint.routing["auth"]
auth_method = (
"none"
if http.is_cors_preflight(request, endpoint)
else endpoint.routing["auth"]
)
if auth_method == "user" and request and request.env and request.env.user:
request.env.user._auth_timeout_check()
return res
5 changes: 3 additions & 2 deletions auth_session_timeout/models/res_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from os.path import getmtime
from time import time

from odoo import api, http, models
from odoo import api, http, models, tools
from odoo.http import SessionExpiredException

_logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -84,7 +84,8 @@ def _auth_timeout_check(self):
terminated = self._auth_timeout_session_terminate(session)

# If session terminated, all done
if terminated:
# Raise an exception if the test is enabled; otherwise, operate as standard.
if terminated and tools.config["test_enable"]:
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't look right - why doesn't the Exception need to be raised in normal Odoo operation?

raise SessionExpiredException("Session expired")

# Else, conditionally update session modified and access times
Expand Down
1 change: 1 addition & 0 deletions auth_session_timeout/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
* Chandresh Thakkar <[email protected]>
* `Greenice <https://www.greenice.com>`_:
* Fernando La Chica <[email protected]>
* Dhara Solanki <[email protected]>
4 changes: 2 additions & 2 deletions auth_session_timeout/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ <h1 class="title">Inactive Sessions Timeout</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/server-auth/tree/15.0/auth_session_timeout"><img alt="OCA/server-auth" src="https://img.shields.io/badge/github-OCA%2Fserver--auth-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/server-auth-15-0/server-auth-15-0-auth_session_timeout"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/251/15.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/server-auth/tree/16.0/auth_session_timeout"><img alt="OCA/server-auth" src="https://img.shields.io/badge/github-OCA%2Fserver--auth-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/server-auth-15-0/server-auth-15-0-auth_session_timeout"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/251/15.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>This module was written to be able to kill(logout) all inactive sessions since
a given delay. On each request the server checks if the session is yet valid
regarding the expiration delay. If not a clean logout is operated.</p>
Expand Down Expand Up @@ -438,7 +438,7 @@ <h2><a class="toc-backref" href="#id7">Maintainers</a></h2>
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/server-auth/tree/15.0/auth_session_timeout">OCA/server-auth</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/server-auth/tree/16.0/auth_session_timeout">OCA/server-auth</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
Expand Down
3 changes: 1 addition & 2 deletions auth_session_timeout/tests/test_res_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

import time
import unittest.mock as mock
from contextlib import contextmanager

import mock

from odoo.http import SessionExpiredException
from odoo.tests.common import TransactionCase
from odoo.tools.misc import mute_logger
Expand Down