diff --git a/auth_session_timeout/README.rst b/auth_session_timeout/README.rst new file mode 100644 index 0000000000..d358873b5b --- /dev/null +++ b/auth_session_timeout/README.rst @@ -0,0 +1,105 @@ +========================= +Inactive Sessions Timeout +========================= + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:809af48b1b6d53fa519fcbd3e75285f656e3e862e7c5c57ba2e7e3a800fab2ff + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png + :target: https://odoo-community.org/page/development-status + :alt: Production/Stable +.. |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/17.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-17-0/server-auth-17-0-auth_session_timeout + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/server-auth&target_branch=17.0 + :alt: Try me on Runboat + +|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 + (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 to smash 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 +- Chandresh Thakkar +- `Greenice `__: + + - Fernando La Chica + +Maintainers +----------- + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +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/__init__.py b/auth_session_timeout/__init__.py new file mode 100644 index 0000000000..3b92252ae0 --- /dev/null +++ b/auth_session_timeout/__init__.py @@ -0,0 +1,4 @@ +# (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 new file mode 100644 index 0000000000..ac74bf46a7 --- /dev/null +++ b/auth_session_timeout/__manifest__.py @@ -0,0 +1,21 @@ +# (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, " + "Jesse Morgan, " + "LasLabs, " + "Odoo Community Association (OCA)", + "maintainer": "Odoo Community Association (OCA)", + "website": "https://github.com/OCA/server-auth", + "category": "Tools", + "development_status": "Production/Stable", + "version": "17.0.1.0.0", + "license": "AGPL-3", + "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..98bb18de77 --- /dev/null +++ b/auth_session_timeout/data/ir_config_parameter_data.xml @@ -0,0 +1,14 @@ + + + + inactive_session_time_out_delay + 7200 + + + inactive_session_time_out_ignored_url + /calendar/notify,/websocket + + diff --git a/auth_session_timeout/i18n/ar.po b/auth_session_timeout/i18n/ar.po new file mode 100644 index 0000000000..592d19a84f --- /dev/null +++ b/auth_session_timeout/i18n/ar.po @@ -0,0 +1,38 @@ +# 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_ir_config_parameter +msgid "System Parameter" +msgstr "" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_res_users +msgid "User" +msgstr "" + +#~ msgid "Users" +#~ 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..4c5d34cc07 --- /dev/null +++ b/auth_session_timeout/i18n/auth_session_timeout.pot @@ -0,0 +1,29 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * auth_session_timeout +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.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_ir_config_parameter +msgid "System Parameter" +msgstr "" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_res_users +msgid "User" +msgstr "" diff --git a/auth_session_timeout/i18n/ca.po b/auth_session_timeout/i18n/ca.po new file mode 100644 index 0000000000..5db4392d57 --- /dev/null +++ b/auth_session_timeout/i18n/ca.po @@ -0,0 +1,38 @@ +# 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: 2024-05-10 08:36+0000\n" +"Last-Translator: jabelchi \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" +"X-Generator: Weblate 4.17\n" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_ir_http +msgid "HTTP Routing" +msgstr "Encaminament HTTP" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_ir_config_parameter +msgid "System Parameter" +msgstr "Paràmetre del sistema" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_res_users +msgid "User" +msgstr "Usuari" + +#~ msgid "Users" +#~ msgstr "Usuaris" diff --git a/auth_session_timeout/i18n/da.po b/auth_session_timeout/i18n/da.po new file mode 100644 index 0000000000..ae4770eda9 --- /dev/null +++ b/auth_session_timeout/i18n/da.po @@ -0,0 +1,37 @@ +# 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_ir_config_parameter +msgid "System Parameter" +msgstr "" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_res_users +msgid "User" +msgstr "" + +#~ msgid "Users" +#~ msgstr "Brugere" diff --git a/auth_session_timeout/i18n/de.po b/auth_session_timeout/i18n/de.po new file mode 100644 index 0000000000..57618de4f3 --- /dev/null +++ b/auth_session_timeout/i18n/de.po @@ -0,0 +1,41 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * auth_session_timeout +# +# Translators: +# OCA Transbot , 2017 +# Niki Waibel , 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: 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" +"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_ir_config_parameter +msgid "System Parameter" +msgstr "" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_res_users +msgid "User" +msgstr "" + +#~ msgid "Users" +#~ msgstr "Benutzer" + +#~ 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..7739c850a1 --- /dev/null +++ b/auth_session_timeout/i18n/el_GR.po @@ -0,0 +1,38 @@ +# 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_ir_config_parameter +msgid "System Parameter" +msgstr "" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_res_users +msgid "User" +msgstr "" + +#~ msgid "Users" +#~ msgstr "Χρήστες" diff --git a/auth_session_timeout/i18n/es.po b/auth_session_timeout/i18n/es.po new file mode 100644 index 0000000000..bf07c2c3fe --- /dev/null +++ b/auth_session_timeout/i18n/es.po @@ -0,0 +1,42 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * auth_session_timeout +# +# Translators: +# OCA Transbot , 2017 +# Pedro M. Baeza , 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: 2023-10-15 19:36+0000\n" +"Last-Translator: Ivorra78 \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" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_ir_http +msgid "HTTP Routing" +msgstr "Enrutamiento HTTP" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_ir_config_parameter +msgid "System Parameter" +msgstr "Parámetro del Sistema" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_res_users +msgid "User" +msgstr "Usuario" + +#~ msgid "Users" +#~ msgstr "Usuarios" + +#~ 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..5e46b63a11 --- /dev/null +++ b/auth_session_timeout/i18n/es_ES.po @@ -0,0 +1,38 @@ +# 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_ir_config_parameter +msgid "System Parameter" +msgstr "" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_res_users +msgid "User" +msgstr "" + +#~ msgid "Users" +#~ msgstr "Usuarios" diff --git a/auth_session_timeout/i18n/fi.po b/auth_session_timeout/i18n/fi.po new file mode 100644 index 0000000000..c4461d7ae7 --- /dev/null +++ b/auth_session_timeout/i18n/fi.po @@ -0,0 +1,37 @@ +# 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_ir_config_parameter +msgid "System Parameter" +msgstr "" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_res_users +msgid "User" +msgstr "" + +#~ msgid "Users" +#~ msgstr "Käyttäjät" diff --git a/auth_session_timeout/i18n/fr.po b/auth_session_timeout/i18n/fr.po new file mode 100644 index 0000000000..28d050c155 --- /dev/null +++ b/auth_session_timeout/i18n/fr.po @@ -0,0 +1,37 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * auth_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" +"Language: 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_ir_config_parameter +msgid "System Parameter" +msgstr "" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_res_users +msgid "User" +msgstr "" + +#~ msgid "Users" +#~ msgstr "Utilisateurs" diff --git a/auth_session_timeout/i18n/fr_CH.po b/auth_session_timeout/i18n/fr_CH.po new file mode 100644 index 0000000000..67c8db90cb --- /dev/null +++ b/auth_session_timeout/i18n/fr_CH.po @@ -0,0 +1,38 @@ +# 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_ir_config_parameter +msgid "System Parameter" +msgstr "" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_res_users +msgid "User" +msgstr "" + +#~ msgid "Users" +#~ msgstr "Utilisateurs" diff --git a/auth_session_timeout/i18n/fr_FR.po b/auth_session_timeout/i18n/fr_FR.po new file mode 100644 index 0000000000..21061807ae --- /dev/null +++ b/auth_session_timeout/i18n/fr_FR.po @@ -0,0 +1,38 @@ +# 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_ir_config_parameter +msgid "System Parameter" +msgstr "" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_res_users +msgid "User" +msgstr "" + +#~ msgid "Users" +#~ msgstr "Utilsateurs" diff --git a/auth_session_timeout/i18n/hr.po b/auth_session_timeout/i18n/hr.po new file mode 100644 index 0000000000..45038b1cb5 --- /dev/null +++ b/auth_session_timeout/i18n/hr.po @@ -0,0 +1,38 @@ +# 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_ir_config_parameter +msgid "System Parameter" +msgstr "" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_res_users +msgid "User" +msgstr "" + +#~ msgid "Users" +#~ msgstr "Korisnici" diff --git a/auth_session_timeout/i18n/hr_HR.po b/auth_session_timeout/i18n/hr_HR.po new file mode 100644 index 0000000000..271451d3cc --- /dev/null +++ b/auth_session_timeout/i18n/hr_HR.po @@ -0,0 +1,39 @@ +# 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_ir_config_parameter +msgid "System Parameter" +msgstr "" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_res_users +msgid "User" +msgstr "" + +#~ msgid "Users" +#~ msgstr "Korisnici" diff --git a/auth_session_timeout/i18n/it.po b/auth_session_timeout/i18n/it.po new file mode 100644 index 0000000000..7691d541ec --- /dev/null +++ b/auth_session_timeout/i18n/it.po @@ -0,0 +1,42 @@ +# 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: 2024-01-03 14:33+0000\n" +"Last-Translator: mymage \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" +"X-Generator: Weblate 4.17\n" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_ir_http +msgid "HTTP Routing" +msgstr "Instradamento HTTP" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_ir_config_parameter +msgid "System Parameter" +msgstr "Parametro di sistema" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_res_users +msgid "User" +msgstr "Utente" + +#~ msgid "Users" +#~ msgstr "Utenti" + +#~ 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..bf1032ebf0 --- /dev/null +++ b/auth_session_timeout/i18n/nl.po @@ -0,0 +1,37 @@ +# 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_ir_config_parameter +msgid "System Parameter" +msgstr "" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_res_users +msgid "User" +msgstr "" + +#~ msgid "Users" +#~ msgstr "Gebruikers" diff --git a/auth_session_timeout/i18n/nl_NL.po b/auth_session_timeout/i18n/nl_NL.po new file mode 100644 index 0000000000..6bc1be4245 --- /dev/null +++ b/auth_session_timeout/i18n/nl_NL.po @@ -0,0 +1,41 @@ +# 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_ir_config_parameter +msgid "System Parameter" +msgstr "" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_res_users +msgid "User" +msgstr "" + +#~ msgid "Users" +#~ msgstr "Gebruikers" + +#~ 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..80cf87d495 --- /dev/null +++ b/auth_session_timeout/i18n/pt.po @@ -0,0 +1,38 @@ +# 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_ir_config_parameter +msgid "System Parameter" +msgstr "" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_res_users +msgid "User" +msgstr "" + +#~ msgid "Users" +#~ msgstr "Utilizadores" diff --git a/auth_session_timeout/i18n/pt_BR.po b/auth_session_timeout/i18n/pt_BR.po new file mode 100644 index 0000000000..1699c2a8b9 --- /dev/null +++ b/auth_session_timeout/i18n/pt_BR.po @@ -0,0 +1,41 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * auth_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: 2022-02-01 20:33+0000\n" +"Last-Translator: Rodrigo Macedo \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" +"Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 4.3.2\n" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_ir_http +msgid "HTTP Routing" +msgstr "Roteamento HTTP" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_ir_config_parameter +msgid "System Parameter" +msgstr "Parâmetro do Sistema" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_res_users +msgid "User" +msgstr "" + +#~ msgid "Users" +#~ msgstr "Usuários" + +#~ msgid "ir.config_parameter" +#~ msgstr "ir.config_parameter" diff --git a/auth_session_timeout/i18n/ro.po b/auth_session_timeout/i18n/ro.po new file mode 100644 index 0000000000..c0b5254234 --- /dev/null +++ b/auth_session_timeout/i18n/ro.po @@ -0,0 +1,42 @@ +# 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_ir_config_parameter +msgid "System Parameter" +msgstr "" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_res_users +msgid "User" +msgstr "" + +#~ msgid "Users" +#~ msgstr "Utilizatori" + +#~ msgid "ir.config_parameter" +#~ msgstr "ir.config_parameter" diff --git a/auth_session_timeout/i18n/sl.po b/auth_session_timeout/i18n/sl.po new file mode 100644 index 0000000000..7701ff8588 --- /dev/null +++ b/auth_session_timeout/i18n/sl.po @@ -0,0 +1,38 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * auth_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" +"Language: sl\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \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_ir_config_parameter +msgid "System Parameter" +msgstr "" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_res_users +msgid "User" +msgstr "" + +#~ msgid "Users" +#~ msgstr "Uporabniki" diff --git a/auth_session_timeout/i18n/tr.po b/auth_session_timeout/i18n/tr.po new file mode 100644 index 0000000000..85895b2dad --- /dev/null +++ b/auth_session_timeout/i18n/tr.po @@ -0,0 +1,37 @@ +# 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_ir_config_parameter +msgid "System Parameter" +msgstr "" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_res_users +msgid "User" +msgstr "" + +#~ msgid "Users" +#~ msgstr "Kullanıcılar" diff --git a/auth_session_timeout/i18n/tr_TR.po b/auth_session_timeout/i18n/tr_TR.po new file mode 100644 index 0000000000..8522e57e67 --- /dev/null +++ b/auth_session_timeout/i18n/tr_TR.po @@ -0,0 +1,38 @@ +# 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_ir_config_parameter +msgid "System Parameter" +msgstr "" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_res_users +msgid "User" +msgstr "" + +#~ msgid "Users" +#~ msgstr "Kullanıcılar" diff --git a/auth_session_timeout/i18n/zh_CN.po b/auth_session_timeout/i18n/zh_CN.po new file mode 100644 index 0000000000..e7c8805a51 --- /dev/null +++ b/auth_session_timeout/i18n/zh_CN.po @@ -0,0 +1,38 @@ +# 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_ir_config_parameter +msgid "System Parameter" +msgstr "" + +#. module: auth_session_timeout +#: model:ir.model,name:auth_session_timeout.model_res_users +msgid "User" +msgstr "" + +#~ msgid "Users" +#~ msgstr "用户" diff --git a/auth_session_timeout/migrations/17.0.1.0.0/pre-migration.py b/auth_session_timeout/migrations/17.0.1.0.0/pre-migration.py new file mode 100644 index 0000000000..d393503b22 --- /dev/null +++ b/auth_session_timeout/migrations/17.0.1.0.0/pre-migration.py @@ -0,0 +1,12 @@ +def migrate(env, version): + """ + Updates the 'inactive_session_time_out_ignored_url' parameter + in the 'ir_config_parameter' table during migration. + """ + env.cr.execute( + """ + UPDATE ir_config_parameter + SET value = '/calendar/notify,/websocket' + WHERE key = 'inactive_session_time_out_ignored_url' + """ + ) diff --git a/auth_session_timeout/models/__init__.py b/auth_session_timeout/models/__init__.py new file mode 100644 index 0000000000..19447fc8e0 --- /dev/null +++ b/auth_session_timeout/models/__init__.py @@ -0,0 +1,6 @@ +# (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_http +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..1a7afd8bbd --- /dev/null +++ b/auth_session_timeout/models/ir_config_parameter.py @@ -0,0 +1,42 @@ +# (c) 2015 ACSONE SA/NV, Dhinesh D +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import api, models, tools + +DELAY_KEY = "inactive_session_time_out_delay" +IGNORED_PATH_KEY = "inactive_session_time_out_ignored_url" + + +class IrConfigParameter(models.Model): + _inherit = "ir.config_parameter" + + @api.model + @tools.ormcache("self.env.cr.dbname") + def _auth_timeout_get_parameter_delay(self): + 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(",") + + def write(self, vals): + res = super().write(vals) + if DELAY_KEY == self.key or IGNORED_PATH_KEY == self.key: + self.env.registry.clear_cache() + return res diff --git a/auth_session_timeout/models/ir_http.py b/auth_session_timeout/models/ir_http.py new file mode 100644 index 0000000000..bc2325293c --- /dev/null +++ b/auth_session_timeout/models/ir_http.py @@ -0,0 +1,19 @@ +# 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, endpoint): + res = super()._authenticate(endpoint=endpoint) + if ( + request + and request.session + and request.session.uid + and not request.env["res.users"].browse(request.session.uid)._is_public() + ): + 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 new file mode 100644 index 0000000000..b87fc66f4d --- /dev/null +++ b/auth_session_timeout/models/res_users.py @@ -0,0 +1,102 @@ +# (c) 2015 ACSONE SA/NV, Dhinesh D + +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +import logging +from os import utime +from os.path import getmtime +from time import time + +from odoo import api, http, models +from odoo.http import SessionExpiredException + +_logger = logging.getLogger(__name__) + + +class ResUsers(models.Model): + _inherit = "res.users" + + @api.model + def _auth_timeout_get_ignored_urls(self): + """Pluggable method for calculating ignored urls + Defaults to stored config param + """ + params = self.env["ir.config_parameter"] + return params._auth_timeout_get_parameter_ignored_urls() + + @api.model + def _auth_timeout_deadline_calculate(self): + """Pluggable method for calculating timeout deadline + Defaults to current time minus delay using delay stored as config + param. + """ + params = self.env["ir.config_parameter"] + delay = params._auth_timeout_get_parameter_delay() + if delay <= 0: + return False + return time() - delay + + @api.model + 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 + + @api.model + def _auth_timeout_check(self): + """Perform session timeout validation and expire if needed.""" + + if not http.request: + return + + session = http.request.session + + # Calculate deadline + deadline = self._auth_timeout_deadline_calculate() + + # Check if past deadline + expired = False + if deadline is not False: + path = http.root.session_store.get_session_filename(session.sid) + try: + expired = getmtime(path) < deadline + except OSError: + _logger.exception( + "Exception reading session file modified time.", + ) + # Force expire the session. Will be resolved with new session. + expired = True + + # Try to terminate the session + terminated = False + if expired: + terminated = self._auth_timeout_session_terminate(session) + + # If session terminated, all done + if terminated: + return SessionExpiredException("Session expired") + + # Else, conditionally update session modified and access times + ignored_urls = self._auth_timeout_get_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, + ) + try: + utime(path, None) + except OSError: + _logger.exception( + "Exception updating session file access/modified times.", + ) diff --git a/auth_session_timeout/pyproject.toml b/auth_session_timeout/pyproject.toml new file mode 100644 index 0000000000..4231d0cccb --- /dev/null +++ b/auth_session_timeout/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/auth_session_timeout/readme/CONFIGURE.md b/auth_session_timeout/readme/CONFIGURE.md new file mode 100644 index 0000000000..5e976aaf82 --- /dev/null +++ b/auth_session_timeout/readme/CONFIGURE.md @@ -0,0 +1,6 @@ +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.md b/auth_session_timeout/readme/CONTRIBUTORS.md new file mode 100644 index 0000000000..98aecf3ef9 --- /dev/null +++ b/auth_session_timeout/readme/CONTRIBUTORS.md @@ -0,0 +1,8 @@ +- Cédric Pigeon \<\> +- Dhinesh D \<\> +- Jesse Morgan \<\> +- Dave Lasley \<\> +- Nadia Afakrouch \<\> +- Chandresh Thakkar \<\> +- [Greenice](https://www.greenice.com): + - Fernando La Chica \<\> diff --git a/auth_session_timeout/readme/DESCRIPTION.md b/auth_session_timeout/readme/DESCRIPTION.md new file mode 100644 index 0000000000..a967fb2340 --- /dev/null +++ b/auth_session_timeout/readme/DESCRIPTION.md @@ -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.md b/auth_session_timeout/readme/USAGE.md new file mode 100644 index 0000000000..5fed5d51c9 --- /dev/null +++ b/auth_session_timeout/readme/USAGE.md @@ -0,0 +1 @@ +Setup the session parameters as described above. diff --git a/auth_session_timeout/static/description/icon.png b/auth_session_timeout/static/description/icon.png new file mode 100644 index 0000000000..3a0328b516 Binary files /dev/null and b/auth_session_timeout/static/description/icon.png differ diff --git a/auth_session_timeout/static/description/index.html b/auth_session_timeout/static/description/index.html new file mode 100644 index 0000000000..5ca6ceb3c0 --- /dev/null +++ b/auth_session_timeout/static/description/index.html @@ -0,0 +1,454 @@ + + + + + +Inactive Sessions Timeout + + + +
+

Inactive Sessions Timeout

+ + +

Production/Stable License: AGPL-3 OCA/server-auth Translate me on Weblate Try me on Runboat

+

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 to smash 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/__init__.py b/auth_session_timeout/tests/__init__.py new file mode 100644 index 0000000000..a7c3f85aba --- /dev/null +++ b/auth_session_timeout/tests/__init__.py @@ -0,0 +1,2 @@ +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 new file mode 100644 index 0000000000..5a38a94f6b --- /dev/null +++ b/auth_session_timeout/tests/test_ir_config_parameter.py @@ -0,0 +1,67 @@ +# (c) 2015 ACSONE SA/NV, Dhinesh D + +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo.tests import common + + +class TestIrConfigParameter(common.TransactionCase): + def setUp(self): + super().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" + ) + + 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_ignored_urls() + self.assertIsInstance(urls, list) + + +class TestIrConfigParameterCaching(common.TransactionCase): + def setUp(self): + super().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[1:], **kwargs) + + orig_get_param = self.param_obj.get_param + self.patch(type(self.param_obj), "get_param", get_param) + + def test_auth_timeout_get_parameter_delay_cache(self): + """It should cache the parameter call.""" + self.get_param_called = False + self.param_obj._auth_timeout_get_parameter_delay() + self.assertTrue(self.get_param_called) + + def test_auth_timeout_get_parameter_ignored_urls_cache(self): + """It should cache the parameter call.""" + self.get_param_called = False + 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) + 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 new file mode 100644 index 0000000000..53adf72f1d --- /dev/null +++ b/auth_session_timeout/tests/test_res_users.py @@ -0,0 +1,105 @@ +# Copyright 2016-2017 LasLabs Inc. +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +import time +from contextlib import contextmanager +from unittest import mock + +from odoo.tests.common import TransactionCase +from odoo.tools.misc import mute_logger + + +class EndTestException(Exception): + """It stops tests from continuing""" + + +class TestResUsers(TransactionCase): + def setUp(self): + super().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 _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() + 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._auth_timeout_check(assets["http"]) + self.assertFalse(res) + + 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._auth_timeout_check(assets["http"]) + 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._auth_timeout_check(assets["http"]) + 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, [] + 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(), + 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 + self._auth_timeout_check(assets["http"]) + + 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)