薪资接口

This commit is contained in:
pengyuthon
2026-01-26 21:46:12 +08:00
parent 5be796de41
commit dc9ca6ae07
43 changed files with 1895 additions and 0 deletions
+105
View File
@@ -0,0 +1,105 @@
=========================
Inactive Sessions Timeout
=========================
..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:4bf08a0095aa7e9cb8c59593811fd93a4a8e111755155f59b14f48fff523d9e3
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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 <https://github.com/OCA/server-auth/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 <https://github.com/OCA/server-auth/issues/new?body=module:%20auth_session_timeout%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
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 <cedric.pigeon@acsone.eu>
- Dhinesh D <dvdhinesh.mail@gmail.com>
- Jesse Morgan <jmorgan.nz@gmail.com>
- Dave Lasley <dave@laslabs.com>
- Nadia Afakrouch <nadia.afa@gmail.com>
- Chandresh Thakkar <cthakkar@opensourceintegrators.com>
- `Greenice <https://www.greenice.com>`__:
- Fernando La Chica <fernandolachica@gmail.com>
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 <https://github.com/OCA/server-auth/tree/17.0/auth_session_timeout>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
+4
View File
@@ -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
+21
View File
@@ -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.1",
"license": "AGPL-3",
"data": ["data/ir_config_parameter_data.xml"],
"installable": True,
}
@@ -0,0 +1,14 @@
<!--
(c) 2015 ACSONE SA/NV, Dhinesh D
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-->
<odoo noupdate="1">
<record id="inactive_session_time_out_delay" model="ir.config_parameter">
<field name="key">inactive_session_time_out_delay</field>
<field name="value">7200</field>
</record>
<record id="inactive_session_time_out_ignored_url" model="ir.config_parameter">
<field name="key">inactive_session_time_out_ignored_url</field>
<field name="value">/calendar/notify,/websocket</field>
</record>
</odoo>
+38
View File
@@ -0,0 +1,38 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * auth_session_timeout
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 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 <transbot@odoo-community.org>, 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 "المستخدمون"
@@ -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 17.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 ""
+38
View File
@@ -0,0 +1,38 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * auth_session_timeout
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 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 <jabelchi@gmail.com>\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"
+37
View File
@@ -0,0 +1,37 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * auth_session_timeout
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 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 <transbot@odoo-community.org>, 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"
+41
View File
@@ -0,0 +1,41 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * auth_session_timeout
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2017
# Niki Waibel <niki.waibel@gmail.com>, 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 <niki.waibel@gmail.com>, 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"
+38
View File
@@ -0,0 +1,38 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * auth_session_timeout
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 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 <transbot@odoo-community.org>, 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 "Χρήστες"
+42
View File
@@ -0,0 +1,42 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * auth_session_timeout
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2017
# Pedro M. Baeza <pedro.baeza@gmail.com>, 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 <informatica@totmaterial.es>\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"
+38
View File
@@ -0,0 +1,38 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * auth_session_timeout
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 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 <transbot@odoo-community.org>, 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"
+37
View File
@@ -0,0 +1,37 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * auth_session_timeout
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 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 <transbot@odoo-community.org>, 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"
+37
View File
@@ -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"
+38
View File
@@ -0,0 +1,38 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * auth_session_timeout
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 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 <transbot@odoo-community.org>, 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"
+38
View File
@@ -0,0 +1,38 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * auth_session_timeout
#
# Translators:
# Aurel <theaurel60@gmail.com>, 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 <theaurel60@gmail.com>, 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"
+38
View File
@@ -0,0 +1,38 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * auth_session_timeout
#
# Translators:
# Bole <bole@dajmi5.com>, 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 <bole@dajmi5.com>, 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"
+39
View File
@@ -0,0 +1,39 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * auth_session_timeout
#
# Translators:
# Bole <bole@dajmi5.com>, 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 <bole@dajmi5.com>, 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"
+42
View File
@@ -0,0 +1,42 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * auth_session_timeout
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2017
# Paolo Valier <paolo.valier@hotmail.it>, 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 <stefano.consolaro@mymage.it>\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"
+37
View File
@@ -0,0 +1,37 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * auth_session_timeout
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 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 <transbot@odoo-community.org>, 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"
+41
View File
@@ -0,0 +1,41 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * auth_session_timeout
#
# Translators:
# Peter Hageman <hageman.p@gmail.com>, 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 <hageman.p@gmail.com>, 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"
+38
View File
@@ -0,0 +1,38 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * auth_session_timeout
#
# Translators:
# Pedro Castro Silva <inactive+pcs.sossia@transifex.com>, 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 <inactive+pcs.sossia@transifex.com>, "
"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"
+41
View File
@@ -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 <rmsolucoeseminformatica@protonmail.com>\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"
+42
View File
@@ -0,0 +1,42 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * auth_session_timeout
#
# Translators:
# Daniel Schweiger <danielcccasle@gmail.com>, 2017
# Dorin Hongu <dhongu@gmail.com>, 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 <dhongu@gmail.com>, 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"
+38
View File
@@ -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č <m.mozetic@matmoz.si>\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"
+37
View File
@@ -0,0 +1,37 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * auth_session_timeout
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 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 <transbot@odoo-community.org>, 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"
+38
View File
@@ -0,0 +1,38 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * auth_session_timeout
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 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 <transbot@odoo-community.org>, 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"
+38
View File
@@ -0,0 +1,38 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * auth_session_timeout
#
# Translators:
# Jeffery Chenn <jeffery9@gmail.com>, 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 <jeffery9@gmail.com>, 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 "用户"
@@ -0,0 +1,12 @@
def migrate(cr, version):
"""
Updates the 'inactive_session_time_out_ignored_url' parameter
in the 'ir_config_parameter' table during migration.
"""
cr.execute(
"""
UPDATE ir_config_parameter
SET value = '/calendar/notify,/websocket'
WHERE key = 'inactive_session_time_out_ignored_url'
"""
)
+6
View File
@@ -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
@@ -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
+19
View File
@@ -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
+102
View File
@@ -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.",
)
+3
View File
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
+6
View File
@@ -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
@@ -0,0 +1,8 @@
- Cédric Pigeon \<<cedric.pigeon@acsone.eu>\>
- Dhinesh D \<<dvdhinesh.mail@gmail.com>\>
- Jesse Morgan \<<jmorgan.nz@gmail.com>\>
- Dave Lasley \<<dave@laslabs.com>\>
- Nadia Afakrouch \<<nadia.afa@gmail.com>\>
- Chandresh Thakkar \<<cthakkar@opensourceintegrators.com>\>
- [Greenice](https://www.greenice.com):
- Fernando La Chica \<<fernandolachica@gmail.com>\>
@@ -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.
+1
View File
@@ -0,0 +1 @@
Setup the session parameters as described above.
Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

@@ -0,0 +1,454 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
<title>Inactive Sessions Timeout</title>
<style type="text/css">
/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }
table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }
.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }
.last, .with-subtitle {
margin-bottom: 0 ! important }
.hidden {
display: none }
.subscript {
vertical-align: sub;
font-size: smaller }
.superscript {
vertical-align: super;
font-size: smaller }
a.toc-backref {
text-decoration: none ;
color: black }
blockquote.epigraph {
margin: 2em 5em ; }
dl.docutils dd {
margin-bottom: 0.5em }
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
overflow: hidden;
}
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
*/
div.abstract {
margin: 2em 5em }
div.abstract p.topic-title {
font-weight: bold ;
text-align: center }
div.admonition, div.attention, div.caution, div.danger, div.error,
div.hint, div.important, div.note, div.tip, div.warning {
margin: 2em ;
border: medium outset ;
padding: 1em }
div.admonition p.admonition-title, div.hint p.admonition-title,
div.important p.admonition-title, div.note p.admonition-title,
div.tip p.admonition-title {
font-weight: bold ;
font-family: sans-serif }
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title, .code .error {
color: red ;
font-weight: bold ;
font-family: sans-serif }
/* Uncomment (and remove this text!) to get reduced vertical space in
compound paragraphs.
div.compound .compound-first, div.compound .compound-middle {
margin-bottom: 0.5em }
div.compound .compound-last, div.compound .compound-middle {
margin-top: 0.5em }
*/
div.dedication {
margin: 2em 5em ;
text-align: center ;
font-style: italic }
div.dedication p.topic-title {
font-weight: bold ;
font-style: normal }
div.figure {
margin-left: 2em ;
margin-right: 2em }
div.footer, div.header {
clear: both;
font-size: smaller }
div.line-block {
display: block ;
margin-top: 1em ;
margin-bottom: 1em }
div.line-block div.line-block {
margin-top: 0 ;
margin-bottom: 0 ;
margin-left: 1.5em }
div.sidebar {
margin: 0 0 0.5em 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
width: 40% ;
float: right ;
clear: right }
div.sidebar p.rubric {
font-family: sans-serif ;
font-size: medium }
div.system-messages {
margin: 5em }
div.system-messages h1 {
color: red }
div.system-message {
border: medium outset ;
padding: 1em }
div.system-message p.system-message-title {
color: red ;
font-weight: bold }
div.topic {
margin: 2em }
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
margin-top: 0.4em }
h1.title {
text-align: center }
h2.subtitle {
text-align: center }
hr.docutils {
width: 75% }
img.align-left, .figure.align-left, object.align-left, table.align-left {
clear: left ;
float: left ;
margin-right: 1em }
img.align-right, .figure.align-right, object.align-right, table.align-right {
clear: right ;
float: right ;
margin-left: 1em }
img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
table.align-center {
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left }
.align-center {
clear: both ;
text-align: center }
.align-right {
text-align: right }
/* reset inner alignment in figures */
div.align-right {
text-align: inherit }
/* div.align-center * { */
/* text-align: left } */
.align-top {
vertical-align: top }
.align-middle {
vertical-align: middle }
.align-bottom {
vertical-align: bottom }
ol.simple, ul.simple {
margin-bottom: 1em }
ol.arabic {
list-style: decimal }
ol.loweralpha {
list-style: lower-alpha }
ol.upperalpha {
list-style: upper-alpha }
ol.lowerroman {
list-style: lower-roman }
ol.upperroman {
list-style: upper-roman }
p.attribution {
text-align: right ;
margin-left: 50% }
p.caption {
font-style: italic }
p.credits {
font-style: italic ;
font-size: smaller }
p.label {
white-space: nowrap }
p.rubric {
font-weight: bold ;
font-size: larger ;
color: maroon ;
text-align: center }
p.sidebar-title {
font-family: sans-serif ;
font-weight: bold ;
font-size: larger }
p.sidebar-subtitle {
font-family: sans-serif ;
font-weight: bold }
p.topic-title {
font-weight: bold }
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font: inherit }
pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em }
pre.code .ln { color: gray; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}
span.classifier {
font-family: sans-serif ;
font-style: oblique }
span.classifier-delimiter {
font-family: sans-serif ;
font-weight: bold }
span.interpreted {
font-family: sans-serif }
span.option {
white-space: nowrap }
span.pre {
white-space: pre }
span.problematic, pre.problematic {
color: red }
span.section-subtitle {
/* font-size relative to parent (h1..h6 element) */
font-size: 80% }
table.citation {
border-left: solid 1px gray;
margin-left: 1px }
table.docinfo {
margin: 2em 4em }
table.docutils {
margin-top: 0.5em ;
margin-bottom: 0.5em }
table.footnote {
border-left: solid 1px black;
margin-left: 1px }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
padding-left: 0.5em ;
padding-right: 0.5em ;
vertical-align: top }
table.docutils th.field-name, table.docinfo th.docinfo-name {
font-weight: bold ;
text-align: left ;
white-space: nowrap ;
padding-left: 0 }
/* "booktabs" style (no vertical lines) */
table.docutils.booktabs {
border: 0px;
border-top: 2px solid;
border-bottom: 2px solid;
border-collapse: collapse;
}
table.docutils.booktabs * {
border: 0px;
}
table.docutils.booktabs th {
border-bottom: thin solid;
text-align: left;
}
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
ul.auto-toc {
list-style-type: none }
</style>
</head>
<body>
<div class="document" id="inactive-sessions-timeout">
<h1 class="title">Inactive Sessions Timeout</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:4bf08a0095aa7e9cb8c59593811fd93a4a8e111755155f59b14f48fff523d9e3
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/server-auth/tree/17.0/auth_session_timeout"><img alt="OCA/server-auth" src="https://img.shields.io/badge/github-OCA%2Fserver--auth-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/server-auth-17-0/server-auth-17-0-auth_session_timeout"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/server-auth&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module was written to be able to kill(logout) all inactive sessions
since a given delay. On each request the server checks if the session is
yet valid regarding the expiration delay. If not a clean logout is
operated.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#configuration" id="toc-entry-1">Configuration</a></li>
<li><a class="reference internal" href="#usage" id="toc-entry-2">Usage</a></li>
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-3">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="toc-entry-4">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="toc-entry-5">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="toc-entry-6">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="toc-entry-7">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="configuration">
<h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
<p>Two system parameters are available:</p>
<ul class="simple">
<li><tt class="docutils literal">inactive_session_time_out_delay</tt>: validity of a session in seconds
(default = 2 Hours)</li>
<li><tt class="docutils literal">inactive_session_time_out_ignored_url</tt>: technical urls where the
check does not occur</li>
</ul>
</div>
<div class="section" id="usage">
<h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
<p>Setup the session parameters as described above.</p>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/server-auth/issues">GitHub Issues</a>.
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
<a class="reference external" href="https://github.com/OCA/server-auth/issues/new?body=module:%20auth_session_timeout%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h1><a class="toc-backref" href="#toc-entry-4">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#toc-entry-5">Authors</a></h2>
<ul class="simple">
<li>ACSONE SA/NV</li>
<li>Dhinesh D</li>
<li>Jesse Morgan</li>
<li>LasLabs</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
<ul class="simple">
<li>Cédric Pigeon &lt;<a class="reference external" href="mailto:cedric.pigeon&#64;acsone.eu">cedric.pigeon&#64;acsone.eu</a>&gt;</li>
<li>Dhinesh D &lt;<a class="reference external" href="mailto:dvdhinesh.mail&#64;gmail.com">dvdhinesh.mail&#64;gmail.com</a>&gt;</li>
<li>Jesse Morgan &lt;<a class="reference external" href="mailto:jmorgan.nz&#64;gmail.com">jmorgan.nz&#64;gmail.com</a>&gt;</li>
<li>Dave Lasley &lt;<a class="reference external" href="mailto:dave&#64;laslabs.com">dave&#64;laslabs.com</a>&gt;</li>
<li>Nadia Afakrouch &lt;<a class="reference external" href="mailto:nadia.afa&#64;gmail.com">nadia.afa&#64;gmail.com</a>&gt;</li>
<li>Chandresh Thakkar &lt;<a class="reference external" href="mailto:cthakkar&#64;opensourceintegrators.com">cthakkar&#64;opensourceintegrators.com</a>&gt;</li>
<li><a class="reference external" href="https://www.greenice.com">Greenice</a>:<ul>
<li>Fernando La Chica &lt;<a class="reference external" href="mailto:fernandolachica&#64;gmail.com">fernandolachica&#64;gmail.com</a>&gt;</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
</a>
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/server-auth/tree/17.0/auth_session_timeout">OCA/server-auth</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
</div>
</body>
</html>
+2
View File
@@ -0,0 +1,2 @@
from . import test_ir_config_parameter
from . import test_res_users
@@ -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)
@@ -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)