From 15580fe11c0f1242a1117d771af71422757eb17f Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Mon, 29 Aug 2016 09:16:59 +0200 Subject: [PATCH 01/29] inactive_session_timeout > auth_session_timeout --- auth_session_timeout/README.rst | 47 ++++++++++++++++++ auth_session_timeout/__init__.py | 6 +++ auth_session_timeout/__openerp__.py | 28 +++++++++++ .../data/ir_config_parameter_data.xml | 21 ++++++++ auth_session_timeout/i18n/de.po | 23 +++++++++ auth_session_timeout/i18n/es.po | 23 +++++++++ auth_session_timeout/i18n/fr.po | 23 +++++++++ auth_session_timeout/i18n/pt_BR.po | 23 +++++++++ auth_session_timeout/i18n/sl.po | 23 +++++++++ auth_session_timeout/models/__init__.py | 7 +++ .../models/ir_config_parameter.py | 36 ++++++++++++++ auth_session_timeout/models/res_users.py | 44 ++++++++++++++++ .../static/description/icon.png | Bin 0 -> 9455 bytes auth_session_timeout/tests/__init__.py | 6 +++ .../tests/test_ir_config_parameter.py | 28 +++++++++++ 15 files changed, 338 insertions(+) create mode 100644 auth_session_timeout/README.rst create mode 100644 auth_session_timeout/__init__.py create mode 100644 auth_session_timeout/__openerp__.py create mode 100644 auth_session_timeout/data/ir_config_parameter_data.xml create mode 100644 auth_session_timeout/i18n/de.po create mode 100644 auth_session_timeout/i18n/es.po create mode 100644 auth_session_timeout/i18n/fr.po create mode 100644 auth_session_timeout/i18n/pt_BR.po create mode 100644 auth_session_timeout/i18n/sl.po create mode 100644 auth_session_timeout/models/__init__.py create mode 100644 auth_session_timeout/models/ir_config_parameter.py create mode 100644 auth_session_timeout/models/res_users.py create mode 100644 auth_session_timeout/static/description/icon.png create mode 100644 auth_session_timeout/tests/__init__.py create mode 100644 auth_session_timeout/tests/test_ir_config_parameter.py diff --git a/auth_session_timeout/README.rst b/auth_session_timeout/README.rst new file mode 100644 index 0000000000..4c9249886f --- /dev/null +++ b/auth_session_timeout/README.rst @@ -0,0 +1,47 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :alt: License: AGPL-3 + +Inactive Sessions Timeout +========================= + +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. + +Configuration +============= + +Two system parameters are available: + +* inactive_session_time_out_delay: validity of a session in seconds (default = 2 Hours) +* inactive_session_time_out_ignored_url: technical urls where the check does not occur + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed feedback +`here `_. + +Credits +======= + +Contributors +------------ + +* Cédric Pigeon +* Dhinesh D + +Maintainer +---------- + +.. image:: http://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: http://odoo-community.org + +This module is maintained by the OCA. + +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. + +To contribute to this module, please visit http://odoo-community.org. diff --git a/auth_session_timeout/__init__.py b/auth_session_timeout/__init__.py new file mode 100644 index 0000000000..9b1fb35b07 --- /dev/null +++ b/auth_session_timeout/__init__.py @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# (c) 2015 ACSONE SA/NV, Dhinesh D + +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import models diff --git a/auth_session_timeout/__openerp__.py b/auth_session_timeout/__openerp__.py new file mode 100644 index 0000000000..a7acc836d0 --- /dev/null +++ b/auth_session_timeout/__openerp__.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- +# (c) 2015 ACSONE SA/NV, Dhinesh D + +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +{ + 'name': "Inactive Sessions Timeout", + + 'summary': """ + This module disable all inactive sessions since a given delay""", + + 'author': "ACSONE SA/NV, Dhinesh D, Odoo Community Association (OCA)", + 'maintainer': 'Odoo Community Association (OCA)', + 'website': "http://acsone.eu", + + 'category': 'Tools', + 'version': '9.0.1.0.0', + 'license': 'AGPL-3', + + 'depends': [ + 'base', + ], + + 'data': [ + 'data/ir_config_parameter_data.xml' + ], + 'installable': True, +} diff --git a/auth_session_timeout/data/ir_config_parameter_data.xml b/auth_session_timeout/data/ir_config_parameter_data.xml new file mode 100644 index 0000000000..96b0194bf3 --- /dev/null +++ b/auth_session_timeout/data/ir_config_parameter_data.xml @@ -0,0 +1,21 @@ + + + + + + + inactive_session_time_out_delay + 7200 + + + + + + inactive_session_time_out_ignored_url + /calendar/notify,/longpolling/poll + + + diff --git a/auth_session_timeout/i18n/de.po b/auth_session_timeout/i18n/de.po new file mode 100644 index 0000000000..96a29cd4eb --- /dev/null +++ b/auth_session_timeout/i18n/de.po @@ -0,0 +1,23 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * inactive_session_timeout +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: server-tools (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-09-29 11:14+0000\n" +"PO-Revision-Date: 2015-09-18 13:55+0000\n" +"Last-Translator: <>\n" +"Language-Team: German (http://www.transifex.com/oca/OCA-server-tools-8-0/language/de/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: de\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: inactive_session_timeout +#: model:ir.model,name:inactive_session_timeout.model_res_users +msgid "Users" +msgstr "Benutzer" diff --git a/auth_session_timeout/i18n/es.po b/auth_session_timeout/i18n/es.po new file mode 100644 index 0000000000..6cfd759133 --- /dev/null +++ b/auth_session_timeout/i18n/es.po @@ -0,0 +1,23 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * inactive_session_timeout +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: server-tools (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-09-29 11:14+0000\n" +"PO-Revision-Date: 2015-09-18 13:55+0000\n" +"Last-Translator: <>\n" +"Language-Team: Spanish (http://www.transifex.com/oca/OCA-server-tools-8-0/language/es/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: es\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: inactive_session_timeout +#: model:ir.model,name:inactive_session_timeout.model_res_users +msgid "Users" +msgstr "Usuarios" diff --git a/auth_session_timeout/i18n/fr.po b/auth_session_timeout/i18n/fr.po new file mode 100644 index 0000000000..c621d03117 --- /dev/null +++ b/auth_session_timeout/i18n/fr.po @@ -0,0 +1,23 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * inactive_session_timeout +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: server-tools (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-09-29 11:14+0000\n" +"PO-Revision-Date: 2015-09-18 13:55+0000\n" +"Last-Translator: <>\n" +"Language-Team: French (http://www.transifex.com/oca/OCA-server-tools-8-0/language/fr/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: fr\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#. module: inactive_session_timeout +#: model:ir.model,name:inactive_session_timeout.model_res_users +msgid "Users" +msgstr "Utilisateurs" diff --git a/auth_session_timeout/i18n/pt_BR.po b/auth_session_timeout/i18n/pt_BR.po new file mode 100644 index 0000000000..c46150de34 --- /dev/null +++ b/auth_session_timeout/i18n/pt_BR.po @@ -0,0 +1,23 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * inactive_session_timeout +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: server-tools (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-09-29 11:14+0000\n" +"PO-Revision-Date: 2015-09-18 13:55+0000\n" +"Last-Translator: <>\n" +"Language-Team: Portuguese (Brazil) (http://www.transifex.com/oca/OCA-server-tools-8-0/language/pt_BR/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: pt_BR\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#. module: inactive_session_timeout +#: model:ir.model,name:inactive_session_timeout.model_res_users +msgid "Users" +msgstr "Usuários" diff --git a/auth_session_timeout/i18n/sl.po b/auth_session_timeout/i18n/sl.po new file mode 100644 index 0000000000..75dd36066b --- /dev/null +++ b/auth_session_timeout/i18n/sl.po @@ -0,0 +1,23 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * inactive_session_timeout +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: server-tools (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-09-29 11:14+0000\n" +"PO-Revision-Date: 2015-09-24 11:47+0000\n" +"Last-Translator: Matjaž Mozetič \n" +"Language-Team: Slovenian (http://www.transifex.com/oca/OCA-server-tools-8-0/language/sl/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: sl\n" +"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n" + +#. module: inactive_session_timeout +#: model:ir.model,name:inactive_session_timeout.model_res_users +msgid "Users" +msgstr "Uporabniki" diff --git a/auth_session_timeout/models/__init__.py b/auth_session_timeout/models/__init__.py new file mode 100644 index 0000000000..0c6063031d --- /dev/null +++ b/auth_session_timeout/models/__init__.py @@ -0,0 +1,7 @@ +# -*- coding: utf-8 -*- +# (c) 2015 ACSONE SA/NV, Dhinesh D + +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import res_users +from . import ir_config_parameter diff --git a/auth_session_timeout/models/ir_config_parameter.py b/auth_session_timeout/models/ir_config_parameter.py new file mode 100644 index 0000000000..69a7003f00 --- /dev/null +++ b/auth_session_timeout/models/ir_config_parameter.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +# (c) 2015 ACSONE SA/NV, Dhinesh D + +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from openerp import models, api, tools, SUPERUSER_ID + + +DELAY_KEY = 'inactive_session_time_out_delay' +IGNORED_PATH_KEY = 'inactive_session_time_out_ignored_url' + + +class IrConfigParameter(models.Model): + _inherit = 'ir.config_parameter' + + @tools.ormcache(skiparg=0) + def get_session_parameters(self, db): + param_model = self.pool['ir.config_parameter'] + cr = self.pool.cursor() + delay = False + urls = [] + try: + delay = int(param_model.get_param( + cr, SUPERUSER_ID, DELAY_KEY, 7200)) + urls = param_model.get_param( + cr, SUPERUSER_ID, IGNORED_PATH_KEY, '').split(',') + finally: + cr.close() + return delay, urls + + @api.multi + def write(self, vals, context=None): + res = super(IrConfigParameter, self).write(vals) + if self.key in [DELAY_KEY, IGNORED_PATH_KEY]: + self.get_session_parameters.clear_cache(self) + return res diff --git a/auth_session_timeout/models/res_users.py b/auth_session_timeout/models/res_users.py new file mode 100644 index 0000000000..95a137df99 --- /dev/null +++ b/auth_session_timeout/models/res_users.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +# (c) 2015 ACSONE SA/NV, Dhinesh D + +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from openerp import models +from openerp import http + +from openerp.http import root +from openerp.http import request + +from os import utime +from os.path import getmtime +from time import time + + +class ResUsers(models.Model): + _inherit = 'res.users' + + def _check_session_validity(self, db, uid, passwd): + if not request: + return + session = request.session + session_store = root.session_store + param_obj = self.pool['ir.config_parameter'] + delay, urls = param_obj.get_session_parameters(db) + deadline = time() - delay + path = session_store.get_session_filename(session.sid) + try: + if getmtime(path) < deadline: + if session.db and session.uid: + session.logout(keep_db=True) + elif http.request.httprequest.path not in urls: + # the session is not expired, update the last modification + # and access time. + utime(path, None) + except OSError: + pass + return + + def check(self, db, uid, passwd): + res = super(ResUsers, self).check(db, uid, passwd) + self._check_session_validity(db, uid, passwd) + return res diff --git a/auth_session_timeout/static/description/icon.png b/auth_session_timeout/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..3a0328b516c4980e8e44cdb63fd945757ddd132d GIT binary patch literal 9455 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 z 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 Xviia!U7SGha1wx#SCgwmn*{w2TRX*I literal 0 HcmV?d00001 diff --git a/auth_session_timeout/tests/__init__.py b/auth_session_timeout/tests/__init__.py new file mode 100644 index 0000000000..7ae3d06924 --- /dev/null +++ b/auth_session_timeout/tests/__init__.py @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# (c) 2015 ACSONE SA/NV, Dhinesh D + +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import test_ir_config_parameter diff --git a/auth_session_timeout/tests/test_ir_config_parameter.py b/auth_session_timeout/tests/test_ir_config_parameter.py new file mode 100644 index 0000000000..f2aa421527 --- /dev/null +++ b/auth_session_timeout/tests/test_ir_config_parameter.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- +# (c) 2015 ACSONE SA/NV, Dhinesh D + +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +import threading + +from openerp.tests import common +import openerp + + +class TestIrConfigParameter(common.TransactionCase): + + def setUp(self): + super(TestIrConfigParameter, self).setUp() + self.db = openerp.tools.config['db_name'] + if not self.db and hasattr(threading.current_thread(), 'dbname'): + self.db = threading.current_thread().dbname + self.param_obj = self.env['ir.config_parameter'] + self.data_obj = self.env['ir.model.data'] + self.delay = self.env.ref( + 'inactive_session_timeout.inactive_session_time_out_delay') + + def test_check_delay(self): + delay, urls = self.param_obj.get_session_parameters(self.db) + self.assertEqual(delay, int(self.delay.value)) + self.assertIsInstance(delay, int) + self.assertIsInstance(urls, list) From 7d965dea99f2c50d6ce86c81dd13b620427f5fa3 Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Mon, 29 Aug 2016 09:34:19 +0200 Subject: [PATCH 02/29] auth_session_timeout: References to old name --- auth_session_timeout/README.rst | 4 ++-- auth_session_timeout/i18n/de.po | 8 ++++---- auth_session_timeout/i18n/es.po | 8 ++++---- auth_session_timeout/i18n/fr.po | 8 ++++---- auth_session_timeout/i18n/pt_BR.po | 8 ++++---- auth_session_timeout/i18n/sl.po | 8 ++++---- auth_session_timeout/tests/test_ir_config_parameter.py | 2 +- 7 files changed, 23 insertions(+), 23 deletions(-) diff --git a/auth_session_timeout/README.rst b/auth_session_timeout/README.rst index 4c9249886f..63325502c0 100644 --- a/auth_session_timeout/README.rst +++ b/auth_session_timeout/README.rst @@ -14,7 +14,7 @@ Configuration Two system parameters are available: * inactive_session_time_out_delay: validity of a session in seconds (default = 2 Hours) -* inactive_session_time_out_ignored_url: technical urls where the check does not occur +* inactive_session_time_out_ignored_url: technical urls where the check does not occur Bug Tracker =========== @@ -22,7 +22,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed feedback -`here `_. +`here `_. Credits ======= diff --git a/auth_session_timeout/i18n/de.po b/auth_session_timeout/i18n/de.po index 96a29cd4eb..e5e60a5e27 100644 --- a/auth_session_timeout/i18n/de.po +++ b/auth_session_timeout/i18n/de.po @@ -1,7 +1,7 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * inactive_session_timeout -# +# * auth_session_timeout +# # Translators: msgid "" msgstr "" @@ -17,7 +17,7 @@ msgstr "" "Language: de\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -#. module: inactive_session_timeout -#: model:ir.model,name:inactive_session_timeout.model_res_users +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_res_users msgid "Users" msgstr "Benutzer" diff --git a/auth_session_timeout/i18n/es.po b/auth_session_timeout/i18n/es.po index 6cfd759133..0728173546 100644 --- a/auth_session_timeout/i18n/es.po +++ b/auth_session_timeout/i18n/es.po @@ -1,7 +1,7 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * inactive_session_timeout -# +# * auth_session_timeout +# # Translators: msgid "" msgstr "" @@ -17,7 +17,7 @@ msgstr "" "Language: es\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -#. module: inactive_session_timeout -#: model:ir.model,name:inactive_session_timeout.model_res_users +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_res_users msgid "Users" msgstr "Usuarios" diff --git a/auth_session_timeout/i18n/fr.po b/auth_session_timeout/i18n/fr.po index c621d03117..2f129e4e64 100644 --- a/auth_session_timeout/i18n/fr.po +++ b/auth_session_timeout/i18n/fr.po @@ -1,7 +1,7 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * inactive_session_timeout -# +# * auth_session_timeout +# # Translators: msgid "" msgstr "" @@ -17,7 +17,7 @@ msgstr "" "Language: fr\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" -#. module: inactive_session_timeout -#: model:ir.model,name:inactive_session_timeout.model_res_users +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_res_users msgid "Users" msgstr "Utilisateurs" diff --git a/auth_session_timeout/i18n/pt_BR.po b/auth_session_timeout/i18n/pt_BR.po index c46150de34..14d4f29b2a 100644 --- a/auth_session_timeout/i18n/pt_BR.po +++ b/auth_session_timeout/i18n/pt_BR.po @@ -1,7 +1,7 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * inactive_session_timeout -# +# * auth_session_timeout +# # Translators: msgid "" msgstr "" @@ -17,7 +17,7 @@ msgstr "" "Language: pt_BR\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" -#. module: inactive_session_timeout -#: model:ir.model,name:inactive_session_timeout.model_res_users +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_res_users msgid "Users" msgstr "Usuários" diff --git a/auth_session_timeout/i18n/sl.po b/auth_session_timeout/i18n/sl.po index 75dd36066b..84ff30b4a9 100644 --- a/auth_session_timeout/i18n/sl.po +++ b/auth_session_timeout/i18n/sl.po @@ -1,7 +1,7 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * inactive_session_timeout -# +# * auth_session_timeout +# # Translators: msgid "" msgstr "" @@ -17,7 +17,7 @@ msgstr "" "Language: sl\n" "Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n" -#. module: inactive_session_timeout -#: model:ir.model,name:inactive_session_timeout.model_res_users +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_res_users msgid "Users" msgstr "Uporabniki" diff --git a/auth_session_timeout/tests/test_ir_config_parameter.py b/auth_session_timeout/tests/test_ir_config_parameter.py index f2aa421527..6a7249f8ee 100644 --- a/auth_session_timeout/tests/test_ir_config_parameter.py +++ b/auth_session_timeout/tests/test_ir_config_parameter.py @@ -19,7 +19,7 @@ def setUp(self): self.param_obj = self.env['ir.config_parameter'] self.data_obj = self.env['ir.model.data'] self.delay = self.env.ref( - 'inactive_session_timeout.inactive_session_time_out_delay') + 'auth_session_timeout.inactive_session_time_out_delay') def test_check_delay(self): delay, urls = self.param_obj.get_session_parameters(self.db) From a768a755fb9e43fc6640fcb58f7180cd04c7f664 Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Thu, 6 Oct 2016 16:08:19 +0200 Subject: [PATCH 03/29] Make modules uninstallable --- auth_session_timeout/__openerp__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/auth_session_timeout/__openerp__.py b/auth_session_timeout/__openerp__.py index a7acc836d0..5b1452402c 100644 --- a/auth_session_timeout/__openerp__.py +++ b/auth_session_timeout/__openerp__.py @@ -24,5 +24,5 @@ 'data': [ 'data/ir_config_parameter_data.xml' ], - 'installable': True, + 'installable': False, } From bdf98342a0e6f2f5255c6671851f23003fd82998 Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Thu, 6 Oct 2016 16:08:27 +0200 Subject: [PATCH 04/29] Rename manifest files --- auth_session_timeout/{__openerp__.py => __manifest__.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename auth_session_timeout/{__openerp__.py => __manifest__.py} (100%) diff --git a/auth_session_timeout/__openerp__.py b/auth_session_timeout/__manifest__.py similarity index 100% rename from auth_session_timeout/__openerp__.py rename to auth_session_timeout/__manifest__.py From e697531fbba5f6ec15e1c831faae3169ec33d7fa Mon Sep 17 00:00:00 2001 From: Dave Lasley Date: Thu, 20 Oct 2016 18:37:10 -0700 Subject: [PATCH 05/29] auth_session_timeout: Migrate to v10 * Bump versions * Installable to 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 --- auth_session_timeout/README.rst | 43 ++++++-- auth_session_timeout/__init__.py | 1 - auth_session_timeout/__manifest__.py | 18 +-- .../data/ir_config_parameter_data.xml | 23 ++-- auth_session_timeout/models/__init__.py | 1 - .../models/ir_config_parameter.py | 31 ++---- auth_session_timeout/models/res_users.py | 29 +++-- auth_session_timeout/tests/__init__.py | 4 +- .../tests/test_ir_config_parameter.py | 32 +++--- auth_session_timeout/tests/test_res_users.py | 104 ++++++++++++++++++ 10 files changed, 195 insertions(+), 91 deletions(-) create mode 100644 auth_session_timeout/tests/test_res_users.py diff --git a/auth_session_timeout/README.rst b/auth_session_timeout/README.rst index 63325502c0..8b0f2c282e 100644 --- a/auth_session_timeout/README.rst +++ b/auth_session_timeout/README.rst @@ -1,6 +1,8 @@ .. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg - :alt: License: AGPL-3 + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +========================= Inactive Sessions Timeout ========================= @@ -13,16 +15,32 @@ Configuration Two system parameters are available: -* inactive_session_time_out_delay: validity of a session in seconds (default = 2 Hours) -* inactive_session_time_out_ignored_url: technical urls where the check does not occur +* ``inactive_session_time_out_delay``: validity of a session in seconds + (default = 2 Hours) +* ``inactive_session_time_out_ignored_url``: technical urls where the check + does not occur + +Usage +===== + +Setup the session parameters as described above. + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/149/9.0 + +Known issues / Roadmap +====================== + Bug Tracker =========== -Bugs are tracked on `GitHub Issues `_. -In case of trouble, please check there if your issue has already been reported. -If you spotted it first, help us smashing it by providing a detailed and welcomed feedback -`here `_. +Bugs are tracked on `GitHub Issues +`_. In case of trouble, please +check there if your issue has already been reported. If you spotted it first, +help us smashing it by providing a detailed and welcomed feedback. + Credits ======= @@ -32,16 +50,19 @@ Contributors * Cédric Pigeon * Dhinesh D +* Dave Lasley Maintainer ---------- -.. image:: http://odoo-community.org/logo.png +.. image:: https://odoo-community.org/logo.png :alt: Odoo Community Association - :target: http://odoo-community.org + :target: https://odoo-community.org This module is maintained by the OCA. -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. +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. -To contribute to this module, please visit http://odoo-community.org. +To contribute to this module, please visit https://odoo-community.org. diff --git a/auth_session_timeout/__init__.py b/auth_session_timeout/__init__.py index 9b1fb35b07..852bfeac28 100644 --- a/auth_session_timeout/__init__.py +++ b/auth_session_timeout/__init__.py @@ -1,6 +1,5 @@ # -*- coding: utf-8 -*- # (c) 2015 ACSONE SA/NV, Dhinesh D - # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import models diff --git a/auth_session_timeout/__manifest__.py b/auth_session_timeout/__manifest__.py index 5b1452402c..837ae425b7 100644 --- a/auth_session_timeout/__manifest__.py +++ b/auth_session_timeout/__manifest__.py @@ -1,28 +1,22 @@ # -*- coding: utf-8 -*- # (c) 2015 ACSONE SA/NV, Dhinesh D - # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { 'name': "Inactive Sessions Timeout", - 'summary': """ This module disable all inactive sessions since a given delay""", - - 'author': "ACSONE SA/NV, Dhinesh D, Odoo Community Association (OCA)", + 'author': "ACSONE SA/NV, " + "Dhinesh D, " + "LasLabs, " + "Odoo Community Association (OCA)", 'maintainer': 'Odoo Community Association (OCA)', 'website': "http://acsone.eu", - 'category': 'Tools', - 'version': '9.0.1.0.0', + 'version': '10.0.1.0.0', 'license': 'AGPL-3', - - 'depends': [ - 'base', - ], - 'data': [ 'data/ir_config_parameter_data.xml' ], - 'installable': False, + 'installable': True, } diff --git a/auth_session_timeout/data/ir_config_parameter_data.xml b/auth_session_timeout/data/ir_config_parameter_data.xml index 96b0194bf3..fb0b1709e7 100644 --- a/auth_session_timeout/data/ir_config_parameter_data.xml +++ b/auth_session_timeout/data/ir_config_parameter_data.xml @@ -4,18 +4,13 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). --> - - - - inactive_session_time_out_delay - 7200 - - - - - - inactive_session_time_out_ignored_url - /calendar/notify,/longpolling/poll - - + + + inactive_session_time_out_delay + 7200 + + + inactive_session_time_out_ignored_url + /calendar/notify,/longpolling/poll + diff --git a/auth_session_timeout/models/__init__.py b/auth_session_timeout/models/__init__.py index 0c6063031d..4c14e36fdb 100644 --- a/auth_session_timeout/models/__init__.py +++ b/auth_session_timeout/models/__init__.py @@ -1,6 +1,5 @@ # -*- coding: utf-8 -*- # (c) 2015 ACSONE SA/NV, Dhinesh D - # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import res_users diff --git a/auth_session_timeout/models/ir_config_parameter.py b/auth_session_timeout/models/ir_config_parameter.py index 69a7003f00..8e2e87e366 100644 --- a/auth_session_timeout/models/ir_config_parameter.py +++ b/auth_session_timeout/models/ir_config_parameter.py @@ -1,9 +1,8 @@ # -*- coding: utf-8 -*- # (c) 2015 ACSONE SA/NV, Dhinesh D - # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from openerp import models, api, tools, SUPERUSER_ID +from odoo import models, api, tools DELAY_KEY = 'inactive_session_time_out_delay' @@ -13,24 +12,18 @@ class IrConfigParameter(models.Model): _inherit = 'ir.config_parameter' - @tools.ormcache(skiparg=0) - def get_session_parameters(self, db): - param_model = self.pool['ir.config_parameter'] - cr = self.pool.cursor() - delay = False - urls = [] - try: - delay = int(param_model.get_param( - cr, SUPERUSER_ID, DELAY_KEY, 7200)) - urls = param_model.get_param( - cr, SUPERUSER_ID, IGNORED_PATH_KEY, '').split(',') - finally: - cr.close() - return delay, urls + @api.model + @tools.ormcache('self.env.cr.dbname') + def get_session_parameters(self): + ConfigParam = self.env['ir.config_parameter'] + delay = ConfigParam.get_param(DELAY_KEY, 7200) + urls = ConfigParam.get_param(IGNORED_PATH_KEY, '').split(',') + return int(delay), urls @api.multi - def write(self, vals, context=None): + def write(self, vals): res = super(IrConfigParameter, self).write(vals) - if self.key in [DELAY_KEY, IGNORED_PATH_KEY]: - self.get_session_parameters.clear_cache(self) + for rec_id in self: + if rec_id.key in (DELAY_KEY, IGNORED_PATH_KEY): + self.get_session_parameters.clear_cache(self) return res diff --git a/auth_session_timeout/models/res_users.py b/auth_session_timeout/models/res_users.py index 95a137df99..db9b5dc6e0 100644 --- a/auth_session_timeout/models/res_users.py +++ b/auth_session_timeout/models/res_users.py @@ -1,29 +1,25 @@ # -*- coding: utf-8 -*- # (c) 2015 ACSONE SA/NV, Dhinesh D - # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from openerp import models -from openerp import http - -from openerp.http import root -from openerp.http import request - from os import utime from os.path import getmtime from time import time +from odoo import models, http + class ResUsers(models.Model): _inherit = 'res.users' - def _check_session_validity(self, db, uid, passwd): - if not request: + @classmethod + def _check_session_validity(cls, db, uid, passwd): + if not http.request: return - session = request.session - session_store = root.session_store - param_obj = self.pool['ir.config_parameter'] - delay, urls = param_obj.get_session_parameters(db) + session = http.request.session + session_store = http.root.session_store + ConfigParam = http.request.env['ir.config_parameter'] + delay, urls = ConfigParam.get_session_parameters() deadline = time() - delay path = session_store.get_session_filename(session.sid) try: @@ -38,7 +34,8 @@ def _check_session_validity(self, db, uid, passwd): pass return - def check(self, db, uid, passwd): - res = super(ResUsers, self).check(db, uid, passwd) - self._check_session_validity(db, uid, passwd) + @classmethod + def check(cls, db, uid, passwd): + res = super(ResUsers, cls).check(db, uid, passwd) + cls._check_session_validity(db, uid, passwd) return res diff --git a/auth_session_timeout/tests/__init__.py b/auth_session_timeout/tests/__init__.py index 7ae3d06924..a4a711662f 100644 --- a/auth_session_timeout/tests/__init__.py +++ b/auth_session_timeout/tests/__init__.py @@ -1,6 +1,4 @@ # -*- coding: utf-8 -*- -# (c) 2015 ACSONE SA/NV, Dhinesh D - -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import test_ir_config_parameter +from . import test_res_users diff --git a/auth_session_timeout/tests/test_ir_config_parameter.py b/auth_session_timeout/tests/test_ir_config_parameter.py index 6a7249f8ee..b5cc8d2de9 100644 --- a/auth_session_timeout/tests/test_ir_config_parameter.py +++ b/auth_session_timeout/tests/test_ir_config_parameter.py @@ -1,28 +1,32 @@ # -*- coding: utf-8 -*- # (c) 2015 ACSONE SA/NV, Dhinesh D - +# Copyright 2016 LasLabs Inc. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -import threading - -from openerp.tests import common -import openerp +from odoo.tests.common import TransactionCase -class TestIrConfigParameter(common.TransactionCase): +class TestIrConfigParameter(TransactionCase): def setUp(self): super(TestIrConfigParameter, self).setUp() - self.db = openerp.tools.config['db_name'] - if not self.db and hasattr(threading.current_thread(), 'dbname'): - self.db = threading.current_thread().dbname self.param_obj = self.env['ir.config_parameter'] self.data_obj = self.env['ir.model.data'] self.delay = self.env.ref( - 'auth_session_timeout.inactive_session_time_out_delay') + 'auth_session_timeout.inactive_session_time_out_delay' + ) + self.url = self.env.ref( + 'auth_session_timeout.inactive_session_time_out_ignored_url' + ) + self.urls = ['url1', 'url2'] + self.url.value = ','.join(self.urls) - def test_check_delay(self): - delay, urls = self.param_obj.get_session_parameters(self.db) + def test_get_session_parameters_delay(self): + """ It should return the proper delay """ + delay, _ = self.param_obj.get_session_parameters() self.assertEqual(delay, int(self.delay.value)) - self.assertIsInstance(delay, int) - self.assertIsInstance(urls, list) + + def test_get_session_parameters_url(self): + """ It should return URIs split by comma """ + _, urls = self.param_obj.get_session_parameters() + self.assertEqual(urls, self.urls) diff --git a/auth_session_timeout/tests/test_res_users.py b/auth_session_timeout/tests/test_res_users.py new file mode 100644 index 0000000000..eab8c802d8 --- /dev/null +++ b/auth_session_timeout/tests/test_res_users.py @@ -0,0 +1,104 @@ +# -*- coding: utf-8 -*- +# Copyright 2016 LasLabs Inc. +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +import mock + +from contextlib import contextmanager + +from odoo.tests.common import TransactionCase + + +class EndTestException(Exception): + """ It stops tests from continuing """ + pass + + +class TestResUsers(TransactionCase): + + def setUp(self): + super(TestResUsers, self).setUp() + self.ResUsers = self.env['res.users'] + + @contextmanager + def _mock_assets(self, assets=None): + """ It provides mocked imports from res_users.py + :param assets: (list) Name of imports to mock. Mocks `http` if None + :return: (dict) Dictionary of mocks, keyed by module name + """ + if assets is None: + assets = ['http'] + patches = {name: mock.DEFAULT for name in assets} + with mock.patch.multiple( + 'odoo.addons.auth_session_timeout.models.res_users', **patches + ) as mocks: + yield mocks + + def _check_session_validity(self): + """ It wraps ``_check_session_validity`` for easier calling """ + self.db = mock.MagicMock() + self.uid = mock.MagicMock() + self.passwd = mock.MagicMock() + return self.ResUsers._check_session_validity( + self.db, self.uid, self.passwd, + ) + + def test_session_validity_no_request(self): + """ It should return immediately if no request """ + with self._mock_assets() as assets: + assets['http'].request = False + res = self._check_session_validity() + self.assertFalse(res) + + def test_session_validity_gets_params(self): + """ It should call ``get_session_parameters`` with db """ + with self._mock_assets() as assets: + get_params = assets['http'].request.env[''].get_session_parameters + get_params.side_effect = EndTestException + with self.assertRaises(EndTestException): + self._check_session_validity() + get_params.assert_called_once_with() + + def test_session_validity_gets_session_file(self): + """ It should call get the session file for the session id """ + with self._mock_assets() as assets: + get_params = assets['http'].request.env[''].get_session_parameters + get_params.return_value = 0, [] + store = assets['http'].root.session_store + store.get_session_filename.side_effect = EndTestException + with self.assertRaises(EndTestException): + self._check_session_validity() + store.get_session_filename.assert_called_once_with( + assets['http'].request.session.sid, + ) + + def test_session_validity_logout(self): + """ It should log out of session if past deadline """ + with self._mock_assets(['http', 'getmtime', 'utime']) as assets: + get_params = assets['http'].request.env[''].get_session_parameters + get_params.return_value = -9999, [] + assets['getmtime'].return_value = 0 + self._check_session_validity() + assets['http'].request.session.logout.assert_called_once_with( + keep_db=True, + ) + + def test_session_validity_updates_utime(self): + """ It should update utime of session file if not expired """ + with self._mock_assets(['http', 'getmtime', 'utime']) as assets: + get_params = assets['http'].request.env[''].get_session_parameters + get_params.return_value = 9999, [] + self._check_session_validity() + assets['utime'].assert_called_once_with( + assets['http'].root.session_store.get_session_filename(), + None, + ) + + def test_session_validity_os_error_guard(self): + """ It should properly guard from OSError & return """ + with self._mock_assets(['http', 'utime', 'getmtime']) as assets: + get_params = assets['http'].request.env[''].get_session_parameters + get_params.return_value = 0, [] + assets['getmtime'].side_effect = OSError + res = self._check_session_validity() + self.assertFalse(res) From 568c4c7ce208695759f6ec3077c5a2bab3472b35 Mon Sep 17 00:00:00 2001 From: jmorgannz Date: Thu, 7 Sep 2017 03:53:23 +1200 Subject: [PATCH 06/29] Module auth_session_timeout: Pluggability (#887) * 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 --- auth_session_timeout/README.rst | 1 + auth_session_timeout/__manifest__.py | 1 + .../models/ir_config_parameter.py | 42 +++++-- auth_session_timeout/models/res_users.py | 115 ++++++++++++++---- .../tests/test_ir_config_parameter.py | 75 +++++++++--- auth_session_timeout/tests/test_res_users.py | 31 +++++ 6 files changed, 211 insertions(+), 54 deletions(-) diff --git a/auth_session_timeout/README.rst b/auth_session_timeout/README.rst index 8b0f2c282e..19397eaac6 100644 --- a/auth_session_timeout/README.rst +++ b/auth_session_timeout/README.rst @@ -50,6 +50,7 @@ Contributors * Cédric Pigeon * Dhinesh D +* Jesse Morgan * Dave Lasley Maintainer diff --git a/auth_session_timeout/__manifest__.py b/auth_session_timeout/__manifest__.py index 837ae425b7..031ed28b92 100644 --- a/auth_session_timeout/__manifest__.py +++ b/auth_session_timeout/__manifest__.py @@ -8,6 +8,7 @@ This module disable all inactive sessions since a given delay""", 'author': "ACSONE SA/NV, " "Dhinesh D, " + "Jesse Morgan, " "LasLabs, " "Odoo Community Association (OCA)", 'maintainer': 'Odoo Community Association (OCA)', diff --git a/auth_session_timeout/models/ir_config_parameter.py b/auth_session_timeout/models/ir_config_parameter.py index 8e2e87e366..bcc8022a38 100644 --- a/auth_session_timeout/models/ir_config_parameter.py +++ b/auth_session_timeout/models/ir_config_parameter.py @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- # (c) 2015 ACSONE SA/NV, Dhinesh D -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from odoo import models, api, tools +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +from odoo import models, api, tools, SUPERUSER_ID DELAY_KEY = 'inactive_session_time_out_delay' IGNORED_PATH_KEY = 'inactive_session_time_out_ignored_url' @@ -12,18 +12,34 @@ class IrConfigParameter(models.Model): _inherit = 'ir.config_parameter' - @api.model - @tools.ormcache('self.env.cr.dbname') - def get_session_parameters(self): - ConfigParam = self.env['ir.config_parameter'] - delay = ConfigParam.get_param(DELAY_KEY, 7200) - urls = ConfigParam.get_param(IGNORED_PATH_KEY, '').split(',') - return int(delay), urls + @tools.ormcache('db') + def get_session_parameters(self, db): + param_model = self.pool['ir.config_parameter'] + cr = self.pool.cursor() + delay = False + urls = [] + try: + delay = int(param_model.get_param( + cr, SUPERUSER_ID, DELAY_KEY, 7200)) + urls = param_model.get_param( + cr, SUPERUSER_ID, IGNORED_PATH_KEY, '').split(',') + finally: + cr.close() + return delay, urls + + def _auth_timeout_get_parameter_delay(self): + delay, urls = self.get_session_parameters(self.pool.db_name) + return delay + + def _auth_timeout_get_parameter_ignoredurls(self): + delay, urls = self.get_session_parameters(self.pool.db_name) + return urls @api.multi - def write(self, vals): + def write(self, vals, context=None): res = super(IrConfigParameter, self).write(vals) - for rec_id in self: - if rec_id.key in (DELAY_KEY, IGNORED_PATH_KEY): - self.get_session_parameters.clear_cache(self) + if self.key == DELAY_KEY: + self.get_session_parameters.clear_cache(self) + elif self.key == IGNORED_PATH_KEY: + self.get_session_parameters.clear_cache(self) return res diff --git a/auth_session_timeout/models/res_users.py b/auth_session_timeout/models/res_users.py index db9b5dc6e0..c916a6d1fe 100644 --- a/auth_session_timeout/models/res_users.py +++ b/auth_session_timeout/models/res_users.py @@ -1,41 +1,110 @@ # -*- coding: utf-8 -*- # (c) 2015 ACSONE SA/NV, Dhinesh D + # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +import logging + +from odoo import models + +from odoo.http import root +from odoo.http import request + from os import utime from os.path import getmtime from time import time -from odoo import models, http +_logger = logging.getLogger(__name__) class ResUsers(models.Model): _inherit = 'res.users' - @classmethod - def _check_session_validity(cls, db, uid, passwd): - if not http.request: + def _auth_timeout_ignoredurls_get(self): + """Pluggable method for calculating ignored urls + Defaults to stored config param + """ + param_model = self.pool['ir.config_parameter'] + return param_model._auth_timeout_get_parameter_ignoredurls() + + def _auth_timeout_deadline_calculate(self): + """Pluggable method for calculating timeout deadline + Defaults to current time minus delay using delay stored as config param + """ + param_model = self.pool['ir.config_parameter'] + delay = param_model._auth_timeout_get_parameter_delay() + if delay is False or delay <= 0: + return False + return time() - delay + + def _auth_timeout_session_terminate(self, session): + """Pluggable method for terminating a timed-out session + + This is a late stage where a session timeout can be aborted. + Useful if you want to do some heavy checking, as it won't be + called unless the session inactivity deadline has been reached. + + Return: + True: session terminated + False: session timeout cancelled + """ + if session.db and session.uid: + session.logout(keep_db=True) + return True + + def _auth_timeout_check(self): + if not request: return - session = http.request.session - session_store = http.root.session_store - ConfigParam = http.request.env['ir.config_parameter'] - delay, urls = ConfigParam.get_session_parameters() - deadline = time() - delay - path = session_store.get_session_filename(session.sid) - try: - if getmtime(path) < deadline: - if session.db and session.uid: - session.logout(keep_db=True) - elif http.request.httprequest.path not in urls: - # the session is not expired, update the last modification - # and access time. + + session = request.session + + # Calculate deadline + deadline = self._auth_timeout_deadline_calculate() + + # Check if past deadline + expired = False + if deadline is not False: + path = root.session_store.get_session_filename(session.sid) + try: + expired = getmtime(path) < deadline + except OSError as e: + _logger.warning( + 'Exception reading session file modified time: %s' + % e + ) + pass + + # Try to terminate the session + terminated = False + if expired: + terminated = self._auth_timeout_session_terminate(session) + + # If session terminated, all done + if terminated: + return + + # Else, conditionally update session modified and access times + ignoredurls = self._auth_timeout_ignoredurls_get() + + if request.httprequest.path not in ignoredurls: + if 'path' not in locals(): + path = root.session_store.get_session_filename(session.sid) + try: utime(path, None) - except OSError: - pass + except OSError as e: + _logger.warning( + 'Exception updating session file access/modified times: %s' + % e + ) + pass + return - @classmethod - def check(cls, db, uid, passwd): - res = super(ResUsers, cls).check(db, uid, passwd) - cls._check_session_validity(db, uid, passwd) + def _check_session_validity(self, db, uid, passwd): + """Adaptor method for backward compatibility""" + return self._auth_timeout_check() + + def check(self, db, uid, passwd): + res = super(ResUsers, self).check(db, uid, passwd) + self._check_session_validity(db, uid, passwd) return res diff --git a/auth_session_timeout/tests/test_ir_config_parameter.py b/auth_session_timeout/tests/test_ir_config_parameter.py index b5cc8d2de9..2b15d2b0de 100644 --- a/auth_session_timeout/tests/test_ir_config_parameter.py +++ b/auth_session_timeout/tests/test_ir_config_parameter.py @@ -1,32 +1,71 @@ # -*- coding: utf-8 -*- # (c) 2015 ACSONE SA/NV, Dhinesh D -# Copyright 2016 LasLabs Inc. + # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from odoo.tests.common import TransactionCase +from odoo.tests import common -class TestIrConfigParameter(TransactionCase): +class TestIrConfigParameter(common.TransactionCase): def setUp(self): super(TestIrConfigParameter, self).setUp() + self.db = self.env.cr.dbname self.param_obj = self.env['ir.config_parameter'] self.data_obj = self.env['ir.model.data'] self.delay = self.env.ref( - 'auth_session_timeout.inactive_session_time_out_delay' - ) - self.url = self.env.ref( - 'auth_session_timeout.inactive_session_time_out_ignored_url' - ) - self.urls = ['url1', 'url2'] - self.url.value = ','.join(self.urls) - - def test_get_session_parameters_delay(self): - """ It should return the proper delay """ - delay, _ = self.param_obj.get_session_parameters() + 'auth_session_timeout.inactive_session_time_out_delay') + + def test_check_session_params(self): + delay, urls = self.param_obj.get_session_parameters(self.db) + self.assertEqual(delay, int(self.delay.value)) + self.assertIsInstance(delay, int) + self.assertIsInstance(urls, list) + + def test_check_session_param_delay(self): + delay = self.param_obj._auth_timeout_get_parameter_delay() self.assertEqual(delay, int(self.delay.value)) + self.assertIsInstance(delay, int) + + def test_check_session_param_urls(self): + urls = self.param_obj._auth_timeout_get_parameter_ignoredurls() + self.assertIsInstance(urls, list) + + +class TestIrConfigParameterCaching(common.TransactionCase): + + def setUp(self): + super(TestIrConfigParameterCaching, self).setUp() + self.db = self.env.cr.dbname + self.param_obj = self.env['ir.config_parameter'] + self.get_param_called = False + test = self + + def get_param(*args, **kwargs): + test.get_param_called = True + return orig_get_param(args[3], args[4]) + orig_get_param = self.param_obj.get_param + self.param_obj._patch_method( + 'get_param', + get_param) + + def tearDown(self): + super(TestIrConfigParameterCaching, self).tearDown() + self.param_obj._revert_method('get_param') + + def test_check_param_cache_working(self): + self.get_param_called = False + delay, urls = self.param_obj.get_session_parameters(self.db) + self.assertTrue(self.get_param_called) + self.get_param_called = False + delay, urls = self.param_obj.get_session_parameters(self.db) + self.assertFalse(self.get_param_called) - def test_get_session_parameters_url(self): - """ It should return URIs split by comma """ - _, urls = self.param_obj.get_session_parameters() - self.assertEqual(urls, self.urls) + def test_check_param_writes_clear_cache(self): + self.get_param_called = False + delay, urls = self.param_obj.get_session_parameters(self.db) + self.assertTrue(self.get_param_called) + self.get_param_called = False + self.param_obj.set_param('inactive_session_time_out_delay', 7201) + delay, urls = self.param_obj.get_session_parameters(self.db) + self.assertTrue(self.get_param_called) diff --git a/auth_session_timeout/tests/test_res_users.py b/auth_session_timeout/tests/test_res_users.py index eab8c802d8..f824dcdce8 100644 --- a/auth_session_timeout/tests/test_res_users.py +++ b/auth_session_timeout/tests/test_res_users.py @@ -3,11 +3,15 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). import mock +from os import strerror +from errno import ENOENT from contextlib import contextmanager from odoo.tests.common import TransactionCase +_package_path = 'odoo.addons.auth_session_timeout' + class EndTestException(Exception): """ It stops tests from continuing """ @@ -102,3 +106,30 @@ def test_session_validity_os_error_guard(self): assets['getmtime'].side_effect = OSError res = self._check_session_validity() self.assertFalse(res) + + @mock.patch(_package_path + '.models.res_users.request') + @mock.patch(_package_path + '.models.res_users.root') + @mock.patch(_package_path + '.models.res_users.getmtime') + def test_on_timeout_session_loggedout(self, mock_getmtime, + mock_root, mock_request): + mock_getmtime.return_value = 0 + mock_request.session.uid = self.env.uid + mock_request.session.dbname = self.env.cr.dbname + mock_request.session.sid = 123 + mock_request.session.logout = mock.Mock() + self.resUsers._auth_timeout_check() + self.assertTrue(mock_request.session.logout.called) + + @mock.patch(_package_path + '.models.res_users.request') + @mock.patch(_package_path + '.models.res_users.root') + @mock.patch(_package_path + '.models.res_users.getmtime') + @mock.patch(_package_path + '.models.res_users.utime') + def test_sessionfile_io_exceptions_managed(self, mock_utime, mock_getmtime, + mock_root, mock_request): + mock_getmtime.side_effect = OSError( + ENOENT, strerror(ENOENT), 'non-existent-filename') + mock_request.session.uid = self.env.uid + mock_request.session.dbname = self.env.cr.dbname + mock_request.session.sid = 123 + self.resUsers._auth_timeout_check() + From 7fd4b877a71c0db2cea7e445c72dbe43423bd43c Mon Sep 17 00:00:00 2001 From: Dave Lasley Date: Mon, 6 Nov 2017 08:39:31 -0800 Subject: [PATCH 07/29] auth_session_timeout: Deprecate backwards compat + improve * Deprecate 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 --- .../models/ir_config_parameter.py | 51 ++++++------- auth_session_timeout/models/res_users.py | 71 +++++++++--------- .../tests/test_ir_config_parameter.py | 37 ++++++---- auth_session_timeout/tests/test_res_users.py | 73 ++++++------------- 4 files changed, 102 insertions(+), 130 deletions(-) diff --git a/auth_session_timeout/models/ir_config_parameter.py b/auth_session_timeout/models/ir_config_parameter.py index bcc8022a38..ea6854942d 100644 --- a/auth_session_timeout/models/ir_config_parameter.py +++ b/auth_session_timeout/models/ir_config_parameter.py @@ -1,9 +1,8 @@ # -*- coding: utf-8 -*- # (c) 2015 ACSONE SA/NV, Dhinesh D - # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from odoo import models, api, tools, SUPERUSER_ID +from odoo import api, models, tools DELAY_KEY = 'inactive_session_time_out_delay' IGNORED_PATH_KEY = 'inactive_session_time_out_ignored_url' @@ -12,34 +11,30 @@ class IrConfigParameter(models.Model): _inherit = 'ir.config_parameter' - @tools.ormcache('db') - def get_session_parameters(self, db): - param_model = self.pool['ir.config_parameter'] - cr = self.pool.cursor() - delay = False - urls = [] - try: - delay = int(param_model.get_param( - cr, SUPERUSER_ID, DELAY_KEY, 7200)) - urls = param_model.get_param( - cr, SUPERUSER_ID, IGNORED_PATH_KEY, '').split(',') - finally: - cr.close() - return delay, urls - + @api.model + @tools.ormcache('self.env.cr.dbname') def _auth_timeout_get_parameter_delay(self): - delay, urls = self.get_session_parameters(self.pool.db_name) - return delay - - def _auth_timeout_get_parameter_ignoredurls(self): - delay, urls = self.get_session_parameters(self.pool.db_name) - return urls + return int( + self.env['ir.config_parameter'].sudo().get_param( + DELAY_KEY, 7200, + ) + ) + + @api.model + @tools.ormcache('self.env.cr.dbname') + def _auth_timeout_get_parameter_ignored_urls(self): + urls = self.env['ir.config_parameter'].sudo().get_param( + IGNORED_PATH_KEY, '', + ) + return urls.split(',') @api.multi - def write(self, vals, context=None): + def write(self, vals): res = super(IrConfigParameter, self).write(vals) - if self.key == DELAY_KEY: - self.get_session_parameters.clear_cache(self) - elif self.key == IGNORED_PATH_KEY: - self.get_session_parameters.clear_cache(self) + self._auth_timeout_get_parameter_delay.clear_cache( + self.filtered(lambda r: r.key == DELAY_KEY), + ) + self._auth_timeout_get_parameter_ignored_urls.clear_cache( + self.filtered(lambda r: r.key == IGNORED_PATH_KEY), + ) return res diff --git a/auth_session_timeout/models/res_users.py b/auth_session_timeout/models/res_users.py index c916a6d1fe..00b0833cce 100644 --- a/auth_session_timeout/models/res_users.py +++ b/auth_session_timeout/models/res_users.py @@ -5,14 +5,11 @@ import logging -from odoo import models - -from odoo.http import root -from odoo.http import request - -from os import utime from os.path import getmtime from time import time +from os import utime + +from odoo import api, http, models _logger = logging.getLogger(__name__) @@ -20,23 +17,27 @@ class ResUsers(models.Model): _inherit = 'res.users' - def _auth_timeout_ignoredurls_get(self): + @api.model_cr_context + def _auth_timeout_get_ignored_urls(self): """Pluggable method for calculating ignored urls Defaults to stored config param """ - param_model = self.pool['ir.config_parameter'] - return param_model._auth_timeout_get_parameter_ignoredurls() + params = self.env['ir.config_parameter'] + return params._auth_timeout_get_parameter_ignored_urls() + @api.model_cr_context def _auth_timeout_deadline_calculate(self): """Pluggable method for calculating timeout deadline - Defaults to current time minus delay using delay stored as config param + Defaults to current time minus delay using delay stored as config + param. """ - param_model = self.pool['ir.config_parameter'] - delay = param_model._auth_timeout_get_parameter_delay() - if delay is False or delay <= 0: + params = self.env['ir.config_parameter'] + delay = params._auth_timeout_get_parameter_delay() + if delay <= 0: return False return time() - delay + @api.model_cr_context def _auth_timeout_session_terminate(self, session): """Pluggable method for terminating a timed-out session @@ -52,11 +53,14 @@ def _auth_timeout_session_terminate(self, session): session.logout(keep_db=True) return True + @api.model_cr_context def _auth_timeout_check(self): - if not request: + """Perform session timeout validation and expire if needed.""" + + if not http.request: return - session = request.session + session = http.request.session # Calculate deadline deadline = self._auth_timeout_deadline_calculate() @@ -64,15 +68,15 @@ def _auth_timeout_check(self): # Check if past deadline expired = False if deadline is not False: - path = root.session_store.get_session_filename(session.sid) + path = http.root.session_store.get_session_filename(session.sid) try: expired = getmtime(path) < deadline except OSError as e: - _logger.warning( - 'Exception reading session file modified time: %s' - % e + _logger.exception( + 'Exception reading session file modified time.', ) - pass + # Force expire the session. Will be resolved with new session. + expired = True # Try to terminate the session terminated = False @@ -84,27 +88,22 @@ def _auth_timeout_check(self): return # Else, conditionally update session modified and access times - ignoredurls = self._auth_timeout_ignoredurls_get() + ignored_urls = self._auth_timeout_get_ignored_urls() - if request.httprequest.path not in ignoredurls: + if http.request.http.request.path not in ignored_urls: if 'path' not in locals(): - path = root.session_store.get_session_filename(session.sid) + path = http.root.session_store.get_session_filename( + session.sid, + ) try: utime(path, None) except OSError as e: - _logger.warning( - 'Exception updating session file access/modified times: %s' - % e + _logger.exception( + 'Exception updating session file access/modified times.', ) - pass - - return - - def _check_session_validity(self, db, uid, passwd): - """Adaptor method for backward compatibility""" - return self._auth_timeout_check() - def check(self, db, uid, passwd): - res = super(ResUsers, self).check(db, uid, passwd) - self._check_session_validity(db, uid, passwd) + @classmethod + def check(cls, *args, **kwargs): + res = super(ResUsers, cls).check(*args, **kwargs) + http.request.env.user._auth_timeout_check() return res diff --git a/auth_session_timeout/tests/test_ir_config_parameter.py b/auth_session_timeout/tests/test_ir_config_parameter.py index 2b15d2b0de..e10e938d8a 100644 --- a/auth_session_timeout/tests/test_ir_config_parameter.py +++ b/auth_session_timeout/tests/test_ir_config_parameter.py @@ -16,19 +16,13 @@ def setUp(self): self.delay = self.env.ref( 'auth_session_timeout.inactive_session_time_out_delay') - def test_check_session_params(self): - delay, urls = self.param_obj.get_session_parameters(self.db) - self.assertEqual(delay, int(self.delay.value)) - self.assertIsInstance(delay, int) - self.assertIsInstance(urls, list) - def test_check_session_param_delay(self): delay = self.param_obj._auth_timeout_get_parameter_delay() self.assertEqual(delay, int(self.delay.value)) self.assertIsInstance(delay, int) def test_check_session_param_urls(self): - urls = self.param_obj._auth_timeout_get_parameter_ignoredurls() + urls = self.param_obj._auth_timeout_get_parameter_ignored_urls() self.assertIsInstance(urls, list) @@ -43,7 +37,8 @@ def setUp(self): def get_param(*args, **kwargs): test.get_param_called = True - return orig_get_param(args[3], args[4]) + return orig_get_param(*args[1:], **kwargs) + orig_get_param = self.param_obj.get_param self.param_obj._patch_method( 'get_param', @@ -53,19 +48,29 @@ def tearDown(self): super(TestIrConfigParameterCaching, self).tearDown() self.param_obj._revert_method('get_param') - def test_check_param_cache_working(self): + def test_auth_timeout_get_parameter_delay_cache(self): + """It should cache the parameter call.""" self.get_param_called = False - delay, urls = self.param_obj.get_session_parameters(self.db) + self.param_obj._auth_timeout_get_parameter_delay() self.assertTrue(self.get_param_called) - self.get_param_called = False - delay, urls = self.param_obj.get_session_parameters(self.db) - self.assertFalse(self.get_param_called) - def test_check_param_writes_clear_cache(self): + def test_auth_timeout_get_parameter_ignored_urls_cache(self): + """It should cache the parameter call.""" self.get_param_called = False - delay, urls = self.param_obj.get_session_parameters(self.db) + self.param_obj._auth_timeout_get_parameter_ignored_urls() self.assertTrue(self.get_param_called) + + def test_check_param_writes_clear_delay_cache(self): + self.param_obj._auth_timeout_get_parameter_delay() self.get_param_called = False self.param_obj.set_param('inactive_session_time_out_delay', 7201) - delay, urls = self.param_obj.get_session_parameters(self.db) + self.param_obj._auth_timeout_get_parameter_delay() + self.assertTrue(self.get_param_called) + + def test_check_param_writes_clear_ignore_url_cache(self): + self.param_obj._auth_timeout_get_parameter_ignored_urls() + self.get_param_called = False + self.param_obj.set_param('inactive_session_time_out_ignored_url', + 'example.com') + self.param_obj._auth_timeout_get_parameter_ignored_urls() self.assertTrue(self.get_param_called) diff --git a/auth_session_timeout/tests/test_res_users.py b/auth_session_timeout/tests/test_res_users.py index f824dcdce8..ad601202e2 100644 --- a/auth_session_timeout/tests/test_res_users.py +++ b/auth_session_timeout/tests/test_res_users.py @@ -1,17 +1,14 @@ # -*- coding: utf-8 -*- -# Copyright 2016 LasLabs Inc. +# Copyright 2016-2017 LasLabs Inc. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). import mock -from os import strerror -from errno import ENOENT from contextlib import contextmanager +from odoo.tools.misc import mute_logger from odoo.tests.common import TransactionCase -_package_path = 'odoo.addons.auth_session_timeout' - class EndTestException(Exception): """ It stops tests from continuing """ @@ -38,31 +35,23 @@ def _mock_assets(self, assets=None): ) as mocks: yield mocks - def _check_session_validity(self): - """ It wraps ``_check_session_validity`` for easier calling """ + def _auth_timeout_check(self, http_mock): + """ It wraps ``_auth_timeout_check`` for easier calling """ self.db = mock.MagicMock() self.uid = mock.MagicMock() self.passwd = mock.MagicMock() - return self.ResUsers._check_session_validity( - self.db, self.uid, self.passwd, - ) + self.path = '/this/is/a/test/path' + get_filename = http_mock.root.session_store.get_session_filename + get_filename.return_value = self.path + return self.ResUsers._auth_timeout_check() def test_session_validity_no_request(self): """ It should return immediately if no request """ with self._mock_assets() as assets: assets['http'].request = False - res = self._check_session_validity() + res = self._auth_timeout_check(assets['http']) self.assertFalse(res) - def test_session_validity_gets_params(self): - """ It should call ``get_session_parameters`` with db """ - with self._mock_assets() as assets: - get_params = assets['http'].request.env[''].get_session_parameters - get_params.side_effect = EndTestException - with self.assertRaises(EndTestException): - self._check_session_validity() - get_params.assert_called_once_with() - def test_session_validity_gets_session_file(self): """ It should call get the session file for the session id """ with self._mock_assets() as assets: @@ -71,7 +60,7 @@ def test_session_validity_gets_session_file(self): store = assets['http'].root.session_store store.get_session_filename.side_effect = EndTestException with self.assertRaises(EndTestException): - self._check_session_validity() + self._auth_timeout_check(assets['http']) store.get_session_filename.assert_called_once_with( assets['http'].request.session.sid, ) @@ -82,7 +71,7 @@ def test_session_validity_logout(self): get_params = assets['http'].request.env[''].get_session_parameters get_params.return_value = -9999, [] assets['getmtime'].return_value = 0 - self._check_session_validity() + self._auth_timeout_check(assets['http']) assets['http'].request.session.logout.assert_called_once_with( keep_db=True, ) @@ -92,44 +81,28 @@ def test_session_validity_updates_utime(self): with self._mock_assets(['http', 'getmtime', 'utime']) as assets: get_params = assets['http'].request.env[''].get_session_parameters get_params.return_value = 9999, [] - self._check_session_validity() + self._auth_timeout_check(assets['http']) assets['utime'].assert_called_once_with( assets['http'].root.session_store.get_session_filename(), None, ) + @mute_logger('odoo.addons.auth_session_timeout.models.res_users') def test_session_validity_os_error_guard(self): """ It should properly guard from OSError & return """ with self._mock_assets(['http', 'utime', 'getmtime']) as assets: get_params = assets['http'].request.env[''].get_session_parameters get_params.return_value = 0, [] assets['getmtime'].side_effect = OSError - res = self._check_session_validity() + res = self._auth_timeout_check(assets['http']) self.assertFalse(res) - @mock.patch(_package_path + '.models.res_users.request') - @mock.patch(_package_path + '.models.res_users.root') - @mock.patch(_package_path + '.models.res_users.getmtime') - def test_on_timeout_session_loggedout(self, mock_getmtime, - mock_root, mock_request): - mock_getmtime.return_value = 0 - mock_request.session.uid = self.env.uid - mock_request.session.dbname = self.env.cr.dbname - mock_request.session.sid = 123 - mock_request.session.logout = mock.Mock() - self.resUsers._auth_timeout_check() - self.assertTrue(mock_request.session.logout.called) - - @mock.patch(_package_path + '.models.res_users.request') - @mock.patch(_package_path + '.models.res_users.root') - @mock.patch(_package_path + '.models.res_users.getmtime') - @mock.patch(_package_path + '.models.res_users.utime') - def test_sessionfile_io_exceptions_managed(self, mock_utime, mock_getmtime, - mock_root, mock_request): - mock_getmtime.side_effect = OSError( - ENOENT, strerror(ENOENT), 'non-existent-filename') - mock_request.session.uid = self.env.uid - mock_request.session.dbname = self.env.cr.dbname - mock_request.session.sid = 123 - self.resUsers._auth_timeout_check() - + def test_on_timeout_session_loggedout(self): + with self._mock_assets(['http', 'getmtime']) as assets: + assets['getmtime'].return_value = 0 + assets['http'].request.session.uid = self.env.uid + assets['http'].request.session.dbname = self.env.cr.dbname + assets['http'].request.session.sid = 123 + assets['http'].request.session.logout = mock.Mock() + self.ResUsers._auth_timeout_check() + self.assertTrue(assets['http'].request.session.logout.called) From 9f13ba8239887e7fa87e6894d5ec1e33f7c1dae0 Mon Sep 17 00:00:00 2001 From: Daniel Masi Date: Wed, 29 Nov 2017 11:52:16 -0500 Subject: [PATCH 08/29] corrects AttributeError: 'HttpRequest' object has no attribute 'http' (#1070) * corrects AttributeError: 'HttpRequest' object has no attribute 'http' * updates the module version number for pull request #1070 --- auth_session_timeout/__manifest__.py | 2 +- auth_session_timeout/models/res_users.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/auth_session_timeout/__manifest__.py b/auth_session_timeout/__manifest__.py index 031ed28b92..422e989656 100644 --- a/auth_session_timeout/__manifest__.py +++ b/auth_session_timeout/__manifest__.py @@ -14,7 +14,7 @@ 'maintainer': 'Odoo Community Association (OCA)', 'website': "http://acsone.eu", 'category': 'Tools', - 'version': '10.0.1.0.0', + 'version': '10.0.1.0.1', 'license': 'AGPL-3', 'data': [ 'data/ir_config_parameter_data.xml' diff --git a/auth_session_timeout/models/res_users.py b/auth_session_timeout/models/res_users.py index 00b0833cce..3082624760 100644 --- a/auth_session_timeout/models/res_users.py +++ b/auth_session_timeout/models/res_users.py @@ -90,7 +90,7 @@ def _auth_timeout_check(self): # Else, conditionally update session modified and access times ignored_urls = self._auth_timeout_get_ignored_urls() - if http.request.http.request.path not in ignored_urls: + if http.request.httprequest.path not in ignored_urls: if 'path' not in locals(): path = http.root.session_store.get_session_filename( session.sid, From 523001015bbf45fd71dd3927e7c9ace0475c4323 Mon Sep 17 00:00:00 2001 From: Nadia AFAKROUCH Date: Sun, 18 Feb 2018 16:49:07 +0100 Subject: [PATCH 09/29] auth_session_timeout: Migration to 11.0 --- auth_session_timeout/.DS_Store | Bin 0 -> 6148 bytes auth_session_timeout/README.rst | 2 +- auth_session_timeout/__init__.py | 1 - auth_session_timeout/__manifest__.py | 3 +-- auth_session_timeout/models/.DS_Store | Bin 0 -> 6148 bytes auth_session_timeout/models/__init__.py | 1 - .../models/ir_config_parameter.py | 1 - auth_session_timeout/models/res_users.py | 2 +- auth_session_timeout/static/.DS_Store | Bin 0 -> 6148 bytes auth_session_timeout/tests/.DS_Store | Bin 0 -> 6148 bytes auth_session_timeout/tests/__init__.py | 2 -- .../tests/test_ir_config_parameter.py | 1 - auth_session_timeout/tests/test_res_users.py | 1 - 13 files changed, 3 insertions(+), 11 deletions(-) create mode 100644 auth_session_timeout/.DS_Store create mode 100644 auth_session_timeout/models/.DS_Store create mode 100644 auth_session_timeout/static/.DS_Store create mode 100644 auth_session_timeout/tests/.DS_Store diff --git a/auth_session_timeout/.DS_Store b/auth_session_timeout/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..60734ebe9cf00e0e0aa8e44f94d9dd41b98fd5aa GIT binary patch literal 6148 zcmeHKK~BRk5L}l~Rd9&}2aY-L0IEue8&MTLKzl_{H5F89NTsy*Jb?=z;RQT_6IY(V z7nrq|$Zpdss?e^qp2Xwz)FZ{NiO3Asd7mgIq8^elIzrPD%yVu zn^T{z=sDCIz4=_Lp47GK2^Z)YyA^e*pb~4G(SoW_^ZE;#0q^OK2bcVFH~D6*t$d(Q zFRs2~cad|NhWh8=0R z8|uE>Vr}-?0i4+!y<>;kssrkPI?y=4`$K|cOa*I)cI!Z6uK>UZ-8S$X^8+vuOa*I) zU=YTY0$r(*D~569=uc!^Dp)&o%%9ldWKxIPssrjk=)i${jrsh) z*?s>Hi}Xz$PzU~%118Ew*$_*Tvvq56eAXt&2P6lNs~y@BG;$o<2R@3=kT$?2`~XY^ TYlrAT=pO-VgEs2GpE~dZwQ`O` literal 0 HcmV?d00001 diff --git a/auth_session_timeout/README.rst b/auth_session_timeout/README.rst index 19397eaac6..b193bb3a97 100644 --- a/auth_session_timeout/README.rst +++ b/auth_session_timeout/README.rst @@ -27,7 +27,7 @@ Setup the session parameters as described above. .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/149/9.0 + :target: https://runbot.odoo-community.org/runbot/149/11.0 Known issues / Roadmap ====================== diff --git a/auth_session_timeout/__init__.py b/auth_session_timeout/__init__.py index 852bfeac28..3b92252ae0 100644 --- a/auth_session_timeout/__init__.py +++ b/auth_session_timeout/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # (c) 2015 ACSONE SA/NV, Dhinesh D # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). diff --git a/auth_session_timeout/__manifest__.py b/auth_session_timeout/__manifest__.py index 422e989656..6f761b946a 100644 --- a/auth_session_timeout/__manifest__.py +++ b/auth_session_timeout/__manifest__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # (c) 2015 ACSONE SA/NV, Dhinesh D # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). @@ -14,7 +13,7 @@ 'maintainer': 'Odoo Community Association (OCA)', 'website': "http://acsone.eu", 'category': 'Tools', - 'version': '10.0.1.0.1', + 'version': '11.0.1.0.1', 'license': 'AGPL-3', 'data': [ 'data/ir_config_parameter_data.xml' diff --git a/auth_session_timeout/models/.DS_Store b/auth_session_timeout/models/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..b1b3f79a6c7ca3f27b492d0aab512c1aad66fd25 GIT binary patch literal 6148 zcmeHKJ5B^K47Fj4mA2V}f-*;7ZxF496RfBQG=tcJ)lR_{bU6;!q2WBd7n{$B0Z|}? zkS)c}No*(cq)B2C(egc_rAbx zTN&gYdw<)1dwa9mbor8DW*};z zKnqnbG1S5_p4=}x7DEdc_2NT)<(J|`>*~m#s=H`53>^#v17ik`t-Iv?e~w>fvdABY zL@yW!2L2fXI%_t~8Xx6%>xa+dU7OG@(J1sQG$61?j{tOdj-1v>n@_aimmP~Cvv9nI P1LGl32?-Sp`~m~dz0oig literal 0 HcmV?d00001 diff --git a/auth_session_timeout/models/__init__.py b/auth_session_timeout/models/__init__.py index 4c14e36fdb..d252eea8bc 100644 --- a/auth_session_timeout/models/__init__.py +++ b/auth_session_timeout/models/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # (c) 2015 ACSONE SA/NV, Dhinesh D # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). diff --git a/auth_session_timeout/models/ir_config_parameter.py b/auth_session_timeout/models/ir_config_parameter.py index ea6854942d..1bed4185a3 100644 --- a/auth_session_timeout/models/ir_config_parameter.py +++ b/auth_session_timeout/models/ir_config_parameter.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # (c) 2015 ACSONE SA/NV, Dhinesh D # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). diff --git a/auth_session_timeout/models/res_users.py b/auth_session_timeout/models/res_users.py index 3082624760..882289b200 100644 --- a/auth_session_timeout/models/res_users.py +++ b/auth_session_timeout/models/res_users.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # (c) 2015 ACSONE SA/NV, Dhinesh D # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). @@ -70,6 +69,7 @@ def _auth_timeout_check(self): if deadline is not False: path = http.root.session_store.get_session_filename(session.sid) try: + expired = getmtime(path) < deadline except OSError as e: _logger.exception( diff --git a/auth_session_timeout/static/.DS_Store b/auth_session_timeout/static/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..390584021b5983f611c5822d9c22b0ca34587108 GIT binary patch literal 6148 zcmeHK!Ab)$5PhRP6ng2=V-9|R{ez{fKVZ*-uq!IK?o!)(e!^e#H~a$;>4CV3Q00S?}8wummt?Qxr8OM29D*PTYA$l#*kM2MpLz_Y;Z!;*jorffl!T zMuWrsKRw>9Hcj6Rw(aw`20j_k^C7V*R*u=Q9351p1R&}&x(IEpB{U{ER*u<_GZe8< zqJ@f=7-HcZPwrPaWzB{dyEd`iu&JnDR)a!&^ax-_&ylk-Y4b^K`c;nEP_yWG R2`9!wpb!!&82AMS-T}J7F?#?2 literal 0 HcmV?d00001 diff --git a/auth_session_timeout/tests/.DS_Store b/auth_session_timeout/tests/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..d149aa691288b78a6aa0423741f33331bf095944 GIT binary patch literal 6148 zcmeHKJ5B>J5S@V(kC?h>kbUFKT}xX4kjhv>djdcfYbEq7Mdw zfnXpQ2nK%60Pbv&`NA;zU?3O>2HqKv^C6)LX2)WvM+Z7B0f6$1R)H?Hg!m-K>{tx3 z0%3Cnnk##W!RC(nb%7 literal 0 HcmV?d00001 diff --git a/auth_session_timeout/tests/__init__.py b/auth_session_timeout/tests/__init__.py index a4a711662f..a7c3f85aba 100644 --- a/auth_session_timeout/tests/__init__.py +++ b/auth_session_timeout/tests/__init__.py @@ -1,4 +1,2 @@ -# -*- coding: utf-8 -*- - from . import test_ir_config_parameter from . import test_res_users diff --git a/auth_session_timeout/tests/test_ir_config_parameter.py b/auth_session_timeout/tests/test_ir_config_parameter.py index e10e938d8a..c190e391c3 100644 --- a/auth_session_timeout/tests/test_ir_config_parameter.py +++ b/auth_session_timeout/tests/test_ir_config_parameter.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # (c) 2015 ACSONE SA/NV, Dhinesh D # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). diff --git a/auth_session_timeout/tests/test_res_users.py b/auth_session_timeout/tests/test_res_users.py index ad601202e2..632021aab8 100644 --- a/auth_session_timeout/tests/test_res_users.py +++ b/auth_session_timeout/tests/test_res_users.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2016-2017 LasLabs Inc. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). From bef08180baf106685f2fe89fbd09beb7f9adb65e Mon Sep 17 00:00:00 2001 From: Katherine Zaoral Date: Thu, 12 Jul 2018 15:47:54 -0300 Subject: [PATCH 10/29] [MIG] auth_session_timeout: Migration to version 11.0 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. --- auth_session_timeout/.DS_Store | Bin 6148 -> 0 bytes auth_session_timeout/README.rst | 75 ++- auth_session_timeout/__manifest__.py | 2 +- auth_session_timeout/i18n/ar.po | 35 ++ .../i18n/auth_session_timeout.pot | 30 ++ auth_session_timeout/i18n/ca.po | 34 ++ auth_session_timeout/i18n/da.po | 34 ++ auth_session_timeout/i18n/de.po | 24 +- auth_session_timeout/i18n/el_GR.po | 35 ++ auth_session_timeout/i18n/es.po | 24 +- auth_session_timeout/i18n/es_ES.po | 35 ++ auth_session_timeout/i18n/fi.po | 34 ++ auth_session_timeout/i18n/fr.po | 15 +- auth_session_timeout/i18n/fr_CH.po | 35 ++ auth_session_timeout/i18n/fr_FR.po | 35 ++ auth_session_timeout/i18n/hr.po | 35 ++ auth_session_timeout/i18n/hr_HR.po | 36 ++ auth_session_timeout/i18n/it.po | 35 ++ auth_session_timeout/i18n/nl.po | 34 ++ auth_session_timeout/i18n/nl_NL.po | 35 ++ auth_session_timeout/i18n/pt.po | 35 ++ auth_session_timeout/i18n/pt_BR.po | 15 +- auth_session_timeout/i18n/ro.po | 36 ++ auth_session_timeout/i18n/sl.po | 18 +- auth_session_timeout/i18n/tr.po | 34 ++ auth_session_timeout/i18n/tr_TR.po | 35 ++ auth_session_timeout/i18n/zh_CN.po | 35 ++ auth_session_timeout/models/.DS_Store | Bin 6148 -> 0 bytes auth_session_timeout/models/__init__.py | 1 + auth_session_timeout/models/ir_http.py | 15 + auth_session_timeout/models/res_users.py | 13 +- auth_session_timeout/readme/CONFIGURE.rst | 8 + auth_session_timeout/readme/CONTRIBUTORS.rst | 6 + auth_session_timeout/readme/DESCRIPTION.rst | 4 + auth_session_timeout/readme/USAGE.rst | 2 + auth_session_timeout/static/.DS_Store | Bin 6148 -> 0 bytes .../static/description/index.html | 444 ++++++++++++++++++ auth_session_timeout/tests/.DS_Store | Bin 6148 -> 0 bytes auth_session_timeout/tests/test_res_users.py | 13 +- 39 files changed, 1282 insertions(+), 54 deletions(-) delete mode 100644 auth_session_timeout/.DS_Store create mode 100644 auth_session_timeout/i18n/ar.po create mode 100644 auth_session_timeout/i18n/auth_session_timeout.pot create mode 100644 auth_session_timeout/i18n/ca.po create mode 100644 auth_session_timeout/i18n/da.po create mode 100644 auth_session_timeout/i18n/el_GR.po create mode 100644 auth_session_timeout/i18n/es_ES.po create mode 100644 auth_session_timeout/i18n/fi.po create mode 100644 auth_session_timeout/i18n/fr_CH.po create mode 100644 auth_session_timeout/i18n/fr_FR.po create mode 100644 auth_session_timeout/i18n/hr.po create mode 100644 auth_session_timeout/i18n/hr_HR.po create mode 100644 auth_session_timeout/i18n/it.po create mode 100644 auth_session_timeout/i18n/nl.po create mode 100644 auth_session_timeout/i18n/nl_NL.po create mode 100644 auth_session_timeout/i18n/pt.po create mode 100644 auth_session_timeout/i18n/ro.po create mode 100644 auth_session_timeout/i18n/tr.po create mode 100644 auth_session_timeout/i18n/tr_TR.po create mode 100644 auth_session_timeout/i18n/zh_CN.po delete mode 100644 auth_session_timeout/models/.DS_Store create mode 100644 auth_session_timeout/models/ir_http.py create mode 100644 auth_session_timeout/readme/CONFIGURE.rst create mode 100644 auth_session_timeout/readme/CONTRIBUTORS.rst create mode 100644 auth_session_timeout/readme/DESCRIPTION.rst create mode 100644 auth_session_timeout/readme/USAGE.rst delete mode 100644 auth_session_timeout/static/.DS_Store create mode 100644 auth_session_timeout/static/description/index.html delete mode 100644 auth_session_timeout/tests/.DS_Store diff --git a/auth_session_timeout/.DS_Store b/auth_session_timeout/.DS_Store deleted file mode 100644 index 60734ebe9cf00e0e0aa8e44f94d9dd41b98fd5aa..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHKK~BRk5L}l~Rd9&}2aY-L0IEue8&MTLKzl_{H5F89NTsy*Jb?=z;RQT_6IY(V z7nrq|$Zpdss?e^qp2Xwz)FZ{NiO3Asd7mgIq8^elIzrPD%yVu zn^T{z=sDCIz4=_Lp47GK2^Z)YyA^e*pb~4G(SoW_^ZE;#0q^OK2bcVFH~D6*t$d(Q zFRs2~cad|NhWh8=0R z8|uE>Vr}-?0i4+!y<>;kssrkPI?y=4`$K|cOa*I)cI!Z6uK>UZ-8S$X^8+vuOa*I) zU=YTY0$r(*D~569=uc!^Dp)&o%%9ldWKxIPssrjk=)i${jrsh) z*?s>Hi}Xz$PzU~%118Ew*$_*Tvvq56eAXt&2P6lNs~y@BG;$o<2R@3=kT$?2`~XY^ TYlrAT=pO-VgEs2GpE~dZwQ`O` diff --git a/auth_session_timeout/README.rst b/auth_session_timeout/README.rst index b193bb3a97..030dbb9a09 100644 --- a/auth_session_timeout/README.rst +++ b/auth_session_timeout/README.rst @@ -1,18 +1,44 @@ -.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg - :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html - :alt: License: AGPL-3 - ========================= Inactive Sessions Timeout ========================= +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :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/11.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-11-0/server-auth-11-0-auth_session_timeout + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/251/11.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + 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. + +**Table of contents** + +.. contents:: + :local: + Configuration ============= + Two system parameters are available: * ``inactive_session_time_out_delay``: validity of a session in seconds @@ -20,50 +46,57 @@ Two system parameters are available: * ``inactive_session_time_out_ignored_url``: technical urls where the check does not occur + Usage ===== Setup the session parameters as described above. -.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas - :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/149/11.0 - -Known issues / Roadmap -====================== - Bug Tracker =========== -Bugs are tracked on `GitHub Issues -`_. In case of trouble, please -check there if your issue has already been reported. If you spotted it first, -help us smashing it by providing a detailed and welcomed feedback. +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. +Do not contact contributors directly about support or help with technical issues. Credits ======= +Authors +~~~~~~~ + +* ACSONE SA/NV +* Dhinesh D +* Jesse Morgan +* LasLabs + Contributors ------------- +~~~~~~~~~~~~ * Cédric Pigeon * Dhinesh D * Jesse Morgan * Dave Lasley +* Nadia Afakrouch + + +Maintainers +~~~~~~~~~~~ -Maintainer ----------- +This module is maintained by the OCA. .. image:: https://odoo-community.org/logo.png :alt: Odoo Community Association :target: https://odoo-community.org -This module is maintained by the OCA. - 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. -To contribute to this module, please visit https://odoo-community.org. +This module is part of the `OCA/server-auth `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/auth_session_timeout/__manifest__.py b/auth_session_timeout/__manifest__.py index 6f761b946a..ab4ccdb704 100644 --- a/auth_session_timeout/__manifest__.py +++ b/auth_session_timeout/__manifest__.py @@ -13,7 +13,7 @@ 'maintainer': 'Odoo Community Association (OCA)', 'website': "http://acsone.eu", 'category': 'Tools', - 'version': '11.0.1.0.1', + 'version': '11.0.1.0.0', 'license': 'AGPL-3', 'data': [ 'data/ir_config_parameter_data.xml' diff --git a/auth_session_timeout/i18n/ar.po b/auth_session_timeout/i18n/ar.po new file mode 100644 index 0000000000..a65a8dc3f5 --- /dev/null +++ b/auth_session_timeout/i18n/ar.po @@ -0,0 +1,35 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * auth_session_timeout +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-12-01 02:09+0000\n" +"PO-Revision-Date: 2017-12-01 02:09+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: Arabic (https://www.transifex.com/oca/teams/23907/ar/)\n" +"Language: ar\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 " +"&& n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;\n" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_ir_http +msgid "HTTP routing" +msgstr "" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_res_users +msgid "Users" +msgstr "المستخدمون" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_ir_config_parameter +msgid "ir.config_parameter" +msgstr "" diff --git a/auth_session_timeout/i18n/auth_session_timeout.pot b/auth_session_timeout/i18n/auth_session_timeout.pot new file mode 100644 index 0000000000..f56fa247ea --- /dev/null +++ b/auth_session_timeout/i18n/auth_session_timeout.pot @@ -0,0 +1,30 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * auth_session_timeout +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_ir_http +msgid "HTTP routing" +msgstr "" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_res_users +msgid "Users" +msgstr "" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_ir_config_parameter +msgid "ir.config_parameter" +msgstr "" + diff --git a/auth_session_timeout/i18n/ca.po b/auth_session_timeout/i18n/ca.po new file mode 100644 index 0000000000..0cc7849b7f --- /dev/null +++ b/auth_session_timeout/i18n/ca.po @@ -0,0 +1,34 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * auth_session_timeout +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-12-01 02:09+0000\n" +"PO-Revision-Date: 2017-12-01 02:09+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: Catalan (https://www.transifex.com/oca/teams/23907/ca/)\n" +"Language: ca\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_ir_http +msgid "HTTP routing" +msgstr "" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_res_users +msgid "Users" +msgstr "Usuaris" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_ir_config_parameter +msgid "ir.config_parameter" +msgstr "" diff --git a/auth_session_timeout/i18n/da.po b/auth_session_timeout/i18n/da.po new file mode 100644 index 0000000000..628315ee82 --- /dev/null +++ b/auth_session_timeout/i18n/da.po @@ -0,0 +1,34 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * auth_session_timeout +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-12-01 02:09+0000\n" +"PO-Revision-Date: 2017-12-01 02:09+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: Danish (https://www.transifex.com/oca/teams/23907/da/)\n" +"Language: da\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_ir_http +msgid "HTTP routing" +msgstr "" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_res_users +msgid "Users" +msgstr "Brugere" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_ir_config_parameter +msgid "ir.config_parameter" +msgstr "" diff --git a/auth_session_timeout/i18n/de.po b/auth_session_timeout/i18n/de.po index e5e60a5e27..f1c9612b90 100644 --- a/auth_session_timeout/i18n/de.po +++ b/auth_session_timeout/i18n/de.po @@ -3,21 +3,33 @@ # * auth_session_timeout # # Translators: +# OCA Transbot , 2017 +# Niki Waibel , 2017 msgid "" msgstr "" -"Project-Id-Version: server-tools (8.0)\n" +"Project-Id-Version: Odoo Server 10.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-09-29 11:14+0000\n" -"PO-Revision-Date: 2015-09-18 13:55+0000\n" -"Last-Translator: <>\n" -"Language-Team: German (http://www.transifex.com/oca/OCA-server-tools-8-0/language/de/)\n" +"POT-Creation-Date: 2017-12-01 02:09+0000\n" +"PO-Revision-Date: 2017-12-01 02:09+0000\n" +"Last-Translator: Niki Waibel , 2017\n" +"Language-Team: German (https://www.transifex.com/oca/teams/23907/de/)\n" +"Language: de\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" -"Language: de\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_ir_http +msgid "HTTP routing" +msgstr "" + #. module: auth_session_timeout #: model:ir.model,name:auth_session_timeout.model_res_users msgid "Users" msgstr "Benutzer" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_ir_config_parameter +msgid "ir.config_parameter" +msgstr "ir.config_parameter" diff --git a/auth_session_timeout/i18n/el_GR.po b/auth_session_timeout/i18n/el_GR.po new file mode 100644 index 0000000000..c9b58540b3 --- /dev/null +++ b/auth_session_timeout/i18n/el_GR.po @@ -0,0 +1,35 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * auth_session_timeout +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-12-01 02:09+0000\n" +"PO-Revision-Date: 2017-12-01 02:09+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: Greek (Greece) (https://www.transifex.com/oca/teams/23907/" +"el_GR/)\n" +"Language: el_GR\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_ir_http +msgid "HTTP routing" +msgstr "" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_res_users +msgid "Users" +msgstr "Χρήστες" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_ir_config_parameter +msgid "ir.config_parameter" +msgstr "" diff --git a/auth_session_timeout/i18n/es.po b/auth_session_timeout/i18n/es.po index 0728173546..0a96d1f594 100644 --- a/auth_session_timeout/i18n/es.po +++ b/auth_session_timeout/i18n/es.po @@ -3,21 +3,33 @@ # * auth_session_timeout # # Translators: +# OCA Transbot , 2017 +# Pedro M. Baeza , 2017 msgid "" msgstr "" -"Project-Id-Version: server-tools (8.0)\n" +"Project-Id-Version: Odoo Server 10.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-09-29 11:14+0000\n" -"PO-Revision-Date: 2015-09-18 13:55+0000\n" -"Last-Translator: <>\n" -"Language-Team: Spanish (http://www.transifex.com/oca/OCA-server-tools-8-0/language/es/)\n" +"POT-Creation-Date: 2017-12-01 02:09+0000\n" +"PO-Revision-Date: 2017-12-01 02:09+0000\n" +"Last-Translator: Pedro M. Baeza , 2017\n" +"Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/es/)\n" +"Language: es\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" -"Language: es\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_ir_http +msgid "HTTP routing" +msgstr "" + #. module: auth_session_timeout #: model:ir.model,name:auth_session_timeout.model_res_users msgid "Users" msgstr "Usuarios" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_ir_config_parameter +msgid "ir.config_parameter" +msgstr "ir.config_parameter" diff --git a/auth_session_timeout/i18n/es_ES.po b/auth_session_timeout/i18n/es_ES.po new file mode 100644 index 0000000000..448b0ccbe3 --- /dev/null +++ b/auth_session_timeout/i18n/es_ES.po @@ -0,0 +1,35 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * auth_session_timeout +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-12-01 02:09+0000\n" +"PO-Revision-Date: 2017-12-01 02:09+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: Spanish (Spain) (https://www.transifex.com/oca/teams/23907/" +"es_ES/)\n" +"Language: es_ES\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_ir_http +msgid "HTTP routing" +msgstr "" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_res_users +msgid "Users" +msgstr "Usuarios" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_ir_config_parameter +msgid "ir.config_parameter" +msgstr "" diff --git a/auth_session_timeout/i18n/fi.po b/auth_session_timeout/i18n/fi.po new file mode 100644 index 0000000000..91ce59c9aa --- /dev/null +++ b/auth_session_timeout/i18n/fi.po @@ -0,0 +1,34 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * auth_session_timeout +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-12-01 02:09+0000\n" +"PO-Revision-Date: 2017-12-01 02:09+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: Finnish (https://www.transifex.com/oca/teams/23907/fi/)\n" +"Language: fi\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_ir_http +msgid "HTTP routing" +msgstr "" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_res_users +msgid "Users" +msgstr "Käyttäjät" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_ir_config_parameter +msgid "ir.config_parameter" +msgstr "" diff --git a/auth_session_timeout/i18n/fr.po b/auth_session_timeout/i18n/fr.po index 2f129e4e64..1cdb0d4bbe 100644 --- a/auth_session_timeout/i18n/fr.po +++ b/auth_session_timeout/i18n/fr.po @@ -10,14 +10,25 @@ msgstr "" "POT-Creation-Date: 2015-09-29 11:14+0000\n" "PO-Revision-Date: 2015-09-18 13:55+0000\n" "Last-Translator: <>\n" -"Language-Team: French (http://www.transifex.com/oca/OCA-server-tools-8-0/language/fr/)\n" +"Language-Team: French (http://www.transifex.com/oca/OCA-server-tools-8-0/" +"language/fr/)\n" +"Language: fr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" -"Language: fr\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_ir_http +msgid "HTTP routing" +msgstr "" + #. module: auth_session_timeout #: model:ir.model,name:auth_session_timeout.model_res_users msgid "Users" msgstr "Utilisateurs" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_ir_config_parameter +msgid "ir.config_parameter" +msgstr "" diff --git a/auth_session_timeout/i18n/fr_CH.po b/auth_session_timeout/i18n/fr_CH.po new file mode 100644 index 0000000000..ff266e206a --- /dev/null +++ b/auth_session_timeout/i18n/fr_CH.po @@ -0,0 +1,35 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * auth_session_timeout +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-12-01 02:09+0000\n" +"PO-Revision-Date: 2017-12-01 02:09+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: French (Switzerland) (https://www.transifex.com/oca/" +"teams/23907/fr_CH/)\n" +"Language: fr_CH\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_ir_http +msgid "HTTP routing" +msgstr "" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_res_users +msgid "Users" +msgstr "Utilisateurs" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_ir_config_parameter +msgid "ir.config_parameter" +msgstr "" diff --git a/auth_session_timeout/i18n/fr_FR.po b/auth_session_timeout/i18n/fr_FR.po new file mode 100644 index 0000000000..087d89f54c --- /dev/null +++ b/auth_session_timeout/i18n/fr_FR.po @@ -0,0 +1,35 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * auth_session_timeout +# +# Translators: +# Aurel , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-12-01 02:09+0000\n" +"PO-Revision-Date: 2017-12-01 02:09+0000\n" +"Last-Translator: Aurel , 2017\n" +"Language-Team: French (France) (https://www.transifex.com/oca/teams/23907/" +"fr_FR/)\n" +"Language: fr_FR\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_ir_http +msgid "HTTP routing" +msgstr "" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_res_users +msgid "Users" +msgstr "Utilsateurs" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_ir_config_parameter +msgid "ir.config_parameter" +msgstr "" diff --git a/auth_session_timeout/i18n/hr.po b/auth_session_timeout/i18n/hr.po new file mode 100644 index 0000000000..9b9044f051 --- /dev/null +++ b/auth_session_timeout/i18n/hr.po @@ -0,0 +1,35 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * auth_session_timeout +# +# Translators: +# Bole , 2016 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-08-31 11:58+0000\n" +"PO-Revision-Date: 2016-08-31 11:58+0000\n" +"Last-Translator: Bole , 2016\n" +"Language-Team: Croatian (https://www.transifex.com/oca/teams/23907/hr/)\n" +"Language: hr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" +"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_ir_http +msgid "HTTP routing" +msgstr "" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_res_users +msgid "Users" +msgstr "Korisnici" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_ir_config_parameter +msgid "ir.config_parameter" +msgstr "" diff --git a/auth_session_timeout/i18n/hr_HR.po b/auth_session_timeout/i18n/hr_HR.po new file mode 100644 index 0000000000..aef650e99d --- /dev/null +++ b/auth_session_timeout/i18n/hr_HR.po @@ -0,0 +1,36 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * auth_session_timeout +# +# Translators: +# Bole , 2016 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-08-31 11:58+0000\n" +"PO-Revision-Date: 2016-08-31 11:58+0000\n" +"Last-Translator: Bole , 2016\n" +"Language-Team: Croatian (Croatia) (https://www.transifex.com/oca/teams/23907/" +"hr_HR/)\n" +"Language: hr_HR\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" +"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_ir_http +msgid "HTTP routing" +msgstr "" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_res_users +msgid "Users" +msgstr "Korisnici" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_ir_config_parameter +msgid "ir.config_parameter" +msgstr "" diff --git a/auth_session_timeout/i18n/it.po b/auth_session_timeout/i18n/it.po new file mode 100644 index 0000000000..09743579fe --- /dev/null +++ b/auth_session_timeout/i18n/it.po @@ -0,0 +1,35 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * auth_session_timeout +# +# Translators: +# OCA Transbot , 2017 +# Paolo Valier , 2018 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-01-06 02:24+0000\n" +"PO-Revision-Date: 2018-01-06 02:24+0000\n" +"Last-Translator: Paolo Valier , 2018\n" +"Language-Team: Italian (https://www.transifex.com/oca/teams/23907/it/)\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_ir_http +msgid "HTTP routing" +msgstr "" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_res_users +msgid "Users" +msgstr "Utenti" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_ir_config_parameter +msgid "ir.config_parameter" +msgstr "ir.config_parameter" diff --git a/auth_session_timeout/i18n/nl.po b/auth_session_timeout/i18n/nl.po new file mode 100644 index 0000000000..2d4a8d7718 --- /dev/null +++ b/auth_session_timeout/i18n/nl.po @@ -0,0 +1,34 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * auth_session_timeout +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-12-01 02:09+0000\n" +"PO-Revision-Date: 2017-12-01 02:09+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: Dutch (https://www.transifex.com/oca/teams/23907/nl/)\n" +"Language: nl\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_ir_http +msgid "HTTP routing" +msgstr "" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_res_users +msgid "Users" +msgstr "Gebruikers" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_ir_config_parameter +msgid "ir.config_parameter" +msgstr "" diff --git a/auth_session_timeout/i18n/nl_NL.po b/auth_session_timeout/i18n/nl_NL.po new file mode 100644 index 0000000000..ebe1c54df0 --- /dev/null +++ b/auth_session_timeout/i18n/nl_NL.po @@ -0,0 +1,35 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * auth_session_timeout +# +# Translators: +# Peter Hageman , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-12-01 02:09+0000\n" +"PO-Revision-Date: 2017-12-01 02:09+0000\n" +"Last-Translator: Peter Hageman , 2017\n" +"Language-Team: Dutch (Netherlands) (https://www.transifex.com/oca/" +"teams/23907/nl_NL/)\n" +"Language: nl_NL\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_ir_http +msgid "HTTP routing" +msgstr "" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_res_users +msgid "Users" +msgstr "Gebruikers" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_ir_config_parameter +msgid "ir.config_parameter" +msgstr "ir.config_parameter" diff --git a/auth_session_timeout/i18n/pt.po b/auth_session_timeout/i18n/pt.po new file mode 100644 index 0000000000..515c10961c --- /dev/null +++ b/auth_session_timeout/i18n/pt.po @@ -0,0 +1,35 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * auth_session_timeout +# +# Translators: +# Pedro Castro Silva , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-12-01 02:09+0000\n" +"PO-Revision-Date: 2017-12-01 02:09+0000\n" +"Last-Translator: Pedro Castro Silva , " +"2017\n" +"Language-Team: Portuguese (https://www.transifex.com/oca/teams/23907/pt/)\n" +"Language: pt\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_ir_http +msgid "HTTP routing" +msgstr "" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_res_users +msgid "Users" +msgstr "Utilizadores" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_ir_config_parameter +msgid "ir.config_parameter" +msgstr "" diff --git a/auth_session_timeout/i18n/pt_BR.po b/auth_session_timeout/i18n/pt_BR.po index 14d4f29b2a..81766afd97 100644 --- a/auth_session_timeout/i18n/pt_BR.po +++ b/auth_session_timeout/i18n/pt_BR.po @@ -10,14 +10,25 @@ msgstr "" "POT-Creation-Date: 2015-09-29 11:14+0000\n" "PO-Revision-Date: 2015-09-18 13:55+0000\n" "Last-Translator: <>\n" -"Language-Team: Portuguese (Brazil) (http://www.transifex.com/oca/OCA-server-tools-8-0/language/pt_BR/)\n" +"Language-Team: Portuguese (Brazil) (http://www.transifex.com/oca/OCA-server-" +"tools-8-0/language/pt_BR/)\n" +"Language: pt_BR\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" -"Language: pt_BR\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_ir_http +msgid "HTTP routing" +msgstr "" + #. module: auth_session_timeout #: model:ir.model,name:auth_session_timeout.model_res_users msgid "Users" msgstr "Usuários" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_ir_config_parameter +msgid "ir.config_parameter" +msgstr "" diff --git a/auth_session_timeout/i18n/ro.po b/auth_session_timeout/i18n/ro.po new file mode 100644 index 0000000000..56d17b1a52 --- /dev/null +++ b/auth_session_timeout/i18n/ro.po @@ -0,0 +1,36 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * auth_session_timeout +# +# Translators: +# Daniel Schweiger , 2017 +# Dorin Hongu , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-12-16 02:16+0000\n" +"PO-Revision-Date: 2017-12-16 02:16+0000\n" +"Last-Translator: Dorin Hongu , 2017\n" +"Language-Team: Romanian (https://www.transifex.com/oca/teams/23907/ro/)\n" +"Language: ro\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=3; plural=(n==1?0:(((n%100>19)||((n%100==0)&&(n!=0)))?" +"2:1));\n" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_ir_http +msgid "HTTP routing" +msgstr "" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_res_users +msgid "Users" +msgstr "Utilizatori" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_ir_config_parameter +msgid "ir.config_parameter" +msgstr "ir.config_parameter" diff --git a/auth_session_timeout/i18n/sl.po b/auth_session_timeout/i18n/sl.po index 84ff30b4a9..f49bfdac3f 100644 --- a/auth_session_timeout/i18n/sl.po +++ b/auth_session_timeout/i18n/sl.po @@ -10,14 +10,26 @@ msgstr "" "POT-Creation-Date: 2015-09-29 11:14+0000\n" "PO-Revision-Date: 2015-09-24 11:47+0000\n" "Last-Translator: Matjaž Mozetič \n" -"Language-Team: Slovenian (http://www.transifex.com/oca/OCA-server-tools-8-0/language/sl/)\n" +"Language-Team: Slovenian (http://www.transifex.com/oca/OCA-server-tools-8-0/" +"language/sl/)\n" +"Language: sl\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" -"Language: sl\n" -"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n" +"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n" +"%100==4 ? 2 : 3);\n" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_ir_http +msgid "HTTP routing" +msgstr "" #. module: auth_session_timeout #: model:ir.model,name:auth_session_timeout.model_res_users msgid "Users" msgstr "Uporabniki" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_ir_config_parameter +msgid "ir.config_parameter" +msgstr "" diff --git a/auth_session_timeout/i18n/tr.po b/auth_session_timeout/i18n/tr.po new file mode 100644 index 0000000000..71331d9168 --- /dev/null +++ b/auth_session_timeout/i18n/tr.po @@ -0,0 +1,34 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * auth_session_timeout +# +# Translators: +# OCA Transbot , 2016 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-08-31 11:58+0000\n" +"PO-Revision-Date: 2016-08-31 11:58+0000\n" +"Last-Translator: OCA Transbot , 2016\n" +"Language-Team: Turkish (https://www.transifex.com/oca/teams/23907/tr/)\n" +"Language: tr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_ir_http +msgid "HTTP routing" +msgstr "" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_res_users +msgid "Users" +msgstr "Kullanıcılar" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_ir_config_parameter +msgid "ir.config_parameter" +msgstr "" diff --git a/auth_session_timeout/i18n/tr_TR.po b/auth_session_timeout/i18n/tr_TR.po new file mode 100644 index 0000000000..dc891e5b16 --- /dev/null +++ b/auth_session_timeout/i18n/tr_TR.po @@ -0,0 +1,35 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * auth_session_timeout +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-12-01 02:09+0000\n" +"PO-Revision-Date: 2017-12-01 02:09+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: Turkish (Turkey) (https://www.transifex.com/oca/teams/23907/" +"tr_TR/)\n" +"Language: tr_TR\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=1; plural=0;\n" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_ir_http +msgid "HTTP routing" +msgstr "" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_res_users +msgid "Users" +msgstr "Kullanıcılar" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_ir_config_parameter +msgid "ir.config_parameter" +msgstr "" diff --git a/auth_session_timeout/i18n/zh_CN.po b/auth_session_timeout/i18n/zh_CN.po new file mode 100644 index 0000000000..e2708b1344 --- /dev/null +++ b/auth_session_timeout/i18n/zh_CN.po @@ -0,0 +1,35 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * auth_session_timeout +# +# Translators: +# Jeffery Chenn , 2016 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-08-31 11:58+0000\n" +"PO-Revision-Date: 2016-08-31 11:58+0000\n" +"Last-Translator: Jeffery Chenn , 2016\n" +"Language-Team: Chinese (China) (https://www.transifex.com/oca/teams/23907/" +"zh_CN/)\n" +"Language: zh_CN\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=1; plural=0;\n" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_ir_http +msgid "HTTP routing" +msgstr "" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_res_users +msgid "Users" +msgstr "用户" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_ir_config_parameter +msgid "ir.config_parameter" +msgstr "" diff --git a/auth_session_timeout/models/.DS_Store b/auth_session_timeout/models/.DS_Store deleted file mode 100644 index b1b3f79a6c7ca3f27b492d0aab512c1aad66fd25..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHKJ5B^K47Fj4mA2V}f-*;7ZxF496RfBQG=tcJ)lR_{bU6;!q2WBd7n{$B0Z|}? zkS)c}No*(cq)B2C(egc_rAbx zTN&gYdw<)1dwa9mbor8DW*};z zKnqnbG1S5_p4=}x7DEdc_2NT)<(J|`>*~m#s=H`53>^#v17ik`t-Iv?e~w>fvdABY zL@yW!2L2fXI%_t~8Xx6%>xa+dU7OG@(J1sQG$61?j{tOdj-1v>n@_aimmP~Cvv9nI P1LGl32?-Sp`~m~dz0oig diff --git a/auth_session_timeout/models/__init__.py b/auth_session_timeout/models/__init__.py index d252eea8bc..19447fc8e0 100644 --- a/auth_session_timeout/models/__init__.py +++ b/auth_session_timeout/models/__init__.py @@ -2,4 +2,5 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import res_users +from . import ir_http from . import ir_config_parameter diff --git a/auth_session_timeout/models/ir_http.py b/auth_session_timeout/models/ir_http.py new file mode 100644 index 0000000000..4b4d518867 --- /dev/null +++ b/auth_session_timeout/models/ir_http.py @@ -0,0 +1,15 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +from odoo import models +from odoo.http import request + + +class IrHttp(models.AbstractModel): + + _inherit = 'ir.http' + + @classmethod + def _authenticate(cls, auth_method='user'): + res = super(IrHttp, cls)._authenticate(auth_method=auth_method) + if request and request.env and request.env.user: + request.env.user._auth_timeout_check() + return res diff --git a/auth_session_timeout/models/res_users.py b/auth_session_timeout/models/res_users.py index 882289b200..82e038d959 100644 --- a/auth_session_timeout/models/res_users.py +++ b/auth_session_timeout/models/res_users.py @@ -9,6 +9,7 @@ from os import utime from odoo import api, http, models +from odoo.http import SessionExpiredException _logger = logging.getLogger(__name__) @@ -71,7 +72,7 @@ def _auth_timeout_check(self): try: expired = getmtime(path) < deadline - except OSError as e: + except OSError: _logger.exception( 'Exception reading session file modified time.', ) @@ -85,7 +86,7 @@ def _auth_timeout_check(self): # If session terminated, all done if terminated: - return + raise SessionExpiredException("Session expired") # Else, conditionally update session modified and access times ignored_urls = self._auth_timeout_get_ignored_urls() @@ -97,13 +98,7 @@ def _auth_timeout_check(self): ) try: utime(path, None) - except OSError as e: + except OSError: _logger.exception( 'Exception updating session file access/modified times.', ) - - @classmethod - def check(cls, *args, **kwargs): - res = super(ResUsers, cls).check(*args, **kwargs) - http.request.env.user._auth_timeout_check() - return res diff --git a/auth_session_timeout/readme/CONFIGURE.rst b/auth_session_timeout/readme/CONFIGURE.rst new file mode 100644 index 0000000000..1fd2fab1a5 --- /dev/null +++ b/auth_session_timeout/readme/CONFIGURE.rst @@ -0,0 +1,8 @@ + +Two system parameters are available: + +* ``inactive_session_time_out_delay``: validity of a session in seconds + (default = 2 Hours) +* ``inactive_session_time_out_ignored_url``: technical urls where the check + does not occur + diff --git a/auth_session_timeout/readme/CONTRIBUTORS.rst b/auth_session_timeout/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000000..01c1c5e99e --- /dev/null +++ b/auth_session_timeout/readme/CONTRIBUTORS.rst @@ -0,0 +1,6 @@ +* Cédric Pigeon +* Dhinesh D +* Jesse Morgan +* Dave Lasley +* Nadia Afakrouch + diff --git a/auth_session_timeout/readme/DESCRIPTION.rst b/auth_session_timeout/readme/DESCRIPTION.rst new file mode 100644 index 0000000000..7e9ca45376 --- /dev/null +++ b/auth_session_timeout/readme/DESCRIPTION.rst @@ -0,0 +1,4 @@ +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. + diff --git a/auth_session_timeout/readme/USAGE.rst b/auth_session_timeout/readme/USAGE.rst new file mode 100644 index 0000000000..a5cea98008 --- /dev/null +++ b/auth_session_timeout/readme/USAGE.rst @@ -0,0 +1,2 @@ +Setup the session parameters as described above. + diff --git a/auth_session_timeout/static/.DS_Store b/auth_session_timeout/static/.DS_Store deleted file mode 100644 index 390584021b5983f611c5822d9c22b0ca34587108..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK!Ab)$5PhRP6ng2=V-9|R{ez{fKVZ*-uq!IK?o!)(e!^e#H~a$;>4CV3Q00S?}8wummt?Qxr8OM29D*PTYA$l#*kM2MpLz_Y;Z!;*jorffl!T zMuWrsKRw>9Hcj6Rw(aw`20j_k^C7V*R*u=Q9351p1R&}&x(IEpB{U{ER*u<_GZe8< zqJ@f=7-HcZPwrPaWzB{dyEd`iu&JnDR)a!&^ax-_&ylk-Y4b^K`c;nEP_yWG R2`9!wpb!!&82AMS-T}J7F?#?2 diff --git a/auth_session_timeout/static/description/index.html b/auth_session_timeout/static/description/index.html new file mode 100644 index 0000000000..327f75f97b --- /dev/null +++ b/auth_session_timeout/static/description/index.html @@ -0,0 +1,444 @@ + + + + + + +Inactive Sessions Timeout + + + +
+

Inactive Sessions Timeout

+ + +

Beta License: AGPL-3 OCA/server-auth Translate me on Weblate Try me on Runbot

+

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.

+

Table of contents

+ +
+

Configuration

+

Two system parameters are available:

+
    +
  • inactive_session_time_out_delay: validity of a session in seconds +(default = 2 Hours)
  • +
  • inactive_session_time_out_ignored_url: technical urls where the check +does not occur
  • +
+
+
+

Usage

+

Setup the session parameters as described above.

+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • ACSONE SA/NV
  • +
  • Dhinesh D
  • +
  • Jesse Morgan
  • +
  • LasLabs
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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 project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/auth_session_timeout/tests/.DS_Store b/auth_session_timeout/tests/.DS_Store deleted file mode 100644 index d149aa691288b78a6aa0423741f33331bf095944..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHKJ5B>J5S@V(kC?h>kbUFKT}xX4kjhv>djdcfYbEq7Mdw zfnXpQ2nK%60Pbv&`NA;zU?3O>2HqKv^C6)LX2)WvM+Z7B0f6$1R)H?Hg!m-K>{tx3 z0%3Cnnk##W!RC(nb%7 diff --git a/auth_session_timeout/tests/test_res_users.py b/auth_session_timeout/tests/test_res_users.py index 632021aab8..81081b0a27 100644 --- a/auth_session_timeout/tests/test_res_users.py +++ b/auth_session_timeout/tests/test_res_users.py @@ -2,11 +2,13 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). import mock +import time from contextlib import contextmanager from odoo.tools.misc import mute_logger from odoo.tests.common import TransactionCase +from odoo.http import SessionExpiredException class EndTestException(Exception): @@ -70,7 +72,8 @@ def test_session_validity_logout(self): get_params = assets['http'].request.env[''].get_session_parameters get_params.return_value = -9999, [] assets['getmtime'].return_value = 0 - self._auth_timeout_check(assets['http']) + with self.assertRaises(SessionExpiredException): + self._auth_timeout_check(assets['http']) assets['http'].request.session.logout.assert_called_once_with( keep_db=True, ) @@ -80,6 +83,7 @@ def test_session_validity_updates_utime(self): with self._mock_assets(['http', 'getmtime', 'utime']) as assets: get_params = assets['http'].request.env[''].get_session_parameters get_params.return_value = 9999, [] + assets['getmtime'].return_value = time.time() self._auth_timeout_check(assets['http']) assets['utime'].assert_called_once_with( assets['http'].root.session_store.get_session_filename(), @@ -93,8 +97,8 @@ def test_session_validity_os_error_guard(self): get_params = assets['http'].request.env[''].get_session_parameters get_params.return_value = 0, [] assets['getmtime'].side_effect = OSError - res = self._auth_timeout_check(assets['http']) - self.assertFalse(res) + with self.assertRaises(SessionExpiredException): + self._auth_timeout_check(assets['http']) def test_on_timeout_session_loggedout(self): with self._mock_assets(['http', 'getmtime']) as assets: @@ -103,5 +107,6 @@ def test_on_timeout_session_loggedout(self): assets['http'].request.session.dbname = self.env.cr.dbname assets['http'].request.session.sid = 123 assets['http'].request.session.logout = mock.Mock() - self.ResUsers._auth_timeout_check() + with self.assertRaises(SessionExpiredException): + self.ResUsers._auth_timeout_check() self.assertTrue(assets['http'].request.session.logout.called) From 534e4ba4d947a0d2d2ba182dd77aa98250bfa7a5 Mon Sep 17 00:00:00 2001 From: Jaime Arroyo Date: Thu, 6 Jun 2019 12:40:32 +0200 Subject: [PATCH 11/29] [12.0][MIG] auth_session_timeout --- auth_session_timeout/README.rst | 10 +++++----- auth_session_timeout/__manifest__.py | 4 ++-- auth_session_timeout/static/description/index.html | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/auth_session_timeout/README.rst b/auth_session_timeout/README.rst index 030dbb9a09..692cd5eb97 100644 --- a/auth_session_timeout/README.rst +++ b/auth_session_timeout/README.rst @@ -14,13 +14,13 @@ 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/11.0/auth_session_timeout + :target: https://github.com/OCA/server-auth/tree/12.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-11-0/server-auth-11-0-auth_session_timeout + :target: https://translation.odoo-community.org/projects/server-auth-12-0/server-auth-12-0-auth_session_timeout :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/251/11.0 + :target: https://runbot.odoo-community.org/runbot/251/12.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -59,7 +59,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -97,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 `_ project on GitHub. +This module is part of the `OCA/server-auth `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/auth_session_timeout/__manifest__.py b/auth_session_timeout/__manifest__.py index ab4ccdb704..81f85f4dbd 100644 --- a/auth_session_timeout/__manifest__.py +++ b/auth_session_timeout/__manifest__.py @@ -11,9 +11,9 @@ "LasLabs, " "Odoo Community Association (OCA)", 'maintainer': 'Odoo Community Association (OCA)', - 'website': "http://acsone.eu", + 'website': "http://www.github.com/OCA/server-auth", 'category': 'Tools', - 'version': '11.0.1.0.0', + 'version': '12.0.1.0.0', 'license': 'AGPL-3', 'data': [ 'data/ir_config_parameter_data.xml' diff --git a/auth_session_timeout/static/description/index.html b/auth_session_timeout/static/description/index.html index 327f75f97b..525a3ca2d8 100644 --- a/auth_session_timeout/static/description/index.html +++ b/auth_session_timeout/static/description/index.html @@ -3,7 +3,7 @@ - + Inactive Sessions Timeout