From 937ec7cec033daa6550676e7332bf726f0cb860f Mon Sep 17 00:00:00 2001 From: Jaime Arroyo Date: Mon, 3 Jun 2019 12:30:21 +0200 Subject: [PATCH] [12.0][MIG] base_remote [UPD] Update base_remote.pot --- base_remote/README.rst | 71 ++-- base_remote/__manifest__.py | 4 +- base_remote/i18n/base_remote.pot | 38 +- base_remote/models/base.py | 4 +- base_remote/models/res_remote.py | 2 +- base_remote/models/res_users.py | 10 +- base_remote/readme/CONTRIBUTORS.rst | 1 + base_remote/readme/DESCRIPTION.rst | 2 + base_remote/readme/USAGE.rst | 3 + base_remote/static/description/index.html | 427 ++++++++++++++++++++++ base_remote/tests/test_remote.py | 3 +- 11 files changed, 512 insertions(+), 53 deletions(-) create mode 100644 base_remote/readme/CONTRIBUTORS.rst create mode 100644 base_remote/readme/DESCRIPTION.rst create mode 100644 base_remote/readme/USAGE.rst create mode 100644 base_remote/static/description/index.html diff --git a/base_remote/README.rst b/base_remote/README.rst index c7f7f4525..8c0ebb16e 100644 --- a/base_remote/README.rst +++ b/base_remote/README.rst @@ -1,58 +1,81 @@ -.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg - :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html - :alt: License: AGPL-3 - =========== Remote Base =========== -This module allows to store all the connected remotes (external ip addresses) to odoo. +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github + :target: https://github.com/OCA/server-tools/tree/12.0/base_remote + :alt: OCA/server-tools +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/server-tools-12-0/server-tools-12-0-base_remote + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/149/12.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module allows to store all the connected remotes (external ip addresses) to Odoo. It should be used with other modules in order to check remote's configurations. +**Table of contents** + +.. contents:: + :local: + Usage ===== When installed, all remotes will be stored by `hostname` on `res.remote`. They can be viewed on `Settings / Remotes`. -The last Ip of the remote will be stored. - -.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas - :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/144/11.0 - +The last IP of the remote will be stored. Bug Tracker =========== -Bugs are tracked on `GitHub Issues -`_. In case of trouble, please -check there if your issue has already been reported. If you spotted it first, -help us smashing it by providing a detailed and welcomed feedback. +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. Credits ======= -Images ------- +Authors +~~~~~~~ -* Odoo Community Association: `Icon `_. +* Creu Blanca Contributors ------------- +~~~~~~~~~~~~ * Enric Tobella -Maintainer ----------- +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. .. image:: https://odoo-community.org/logo.png :alt: Odoo Community Association :target: https://odoo-community.org -This module is maintained by the OCA. - OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. -To contribute to this module, please visit https://odoo-community.org. +This module is part of the `OCA/server-tools `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/base_remote/__manifest__.py b/base_remote/__manifest__.py index f80f540cc..16301dce3 100644 --- a/base_remote/__manifest__.py +++ b/base_remote/__manifest__.py @@ -3,12 +3,12 @@ { 'name': "Remote Base", - 'version': '11.0.1.0.4', + 'version': '12.0.1.0.0', 'category': 'Generic Modules/Base', 'author': "Creu Blanca, Odoo Community Association (OCA)", 'website': 'http://github.com/OCA/server-tools', 'license': 'AGPL-3', - "depends": ['web', 'base'], + "depends": ['web'], 'data': [ 'security/ir.model.access.csv', 'views/res_remote_views.xml', diff --git a/base_remote/i18n/base_remote.pot b/base_remote/i18n/base_remote.pot index 59aa20446..b3395eb4a 100644 --- a/base_remote/i18n/base_remote.pot +++ b/base_remote/i18n/base_remote.pot @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 11.0\n" +"Project-Id-Version: Odoo Server 12.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: <>\n" "Language-Team: \n" @@ -14,22 +14,27 @@ msgstr "" "Plural-Forms: \n" #. module: base_remote -#: model:ir.model.fields,field_description:base_remote.field_res_remote_create_uid +#: model:ir.model,name:base_remote.model_base +msgid "Base" +msgstr "" + +#. module: base_remote +#: model:ir.model.fields,field_description:base_remote.field_res_remote__create_uid msgid "Created by" msgstr "" #. module: base_remote -#: model:ir.model.fields,field_description:base_remote.field_res_remote_create_date +#: model:ir.model.fields,field_description:base_remote.field_res_remote__create_date msgid "Created on" msgstr "" #. module: base_remote -#: model:ir.model.fields,field_description:base_remote.field_res_remote_display_name +#: model:ir.model.fields,field_description:base_remote.field_res_remote__display_name msgid "Display Name" msgstr "" #. module: base_remote -#: model:ir.model.fields,field_description:base_remote.field_res_remote_name +#: model:ir.model.fields,field_description:base_remote.field_res_remote__name msgid "Hostname" msgstr "" @@ -39,37 +44,37 @@ msgid "Hostname must be unique" msgstr "" #. module: base_remote -#: model:ir.model.fields,field_description:base_remote.field_res_remote_id +#: model:ir.model.fields,field_description:base_remote.field_res_remote__id msgid "ID" msgstr "" #. module: base_remote -#: model:ir.model.fields,field_description:base_remote.field_res_remote_in_network +#: model:ir.model.fields,field_description:base_remote.field_res_remote__in_network msgid "In Network" msgstr "" #. module: base_remote -#: model:ir.model.fields,field_description:base_remote.field_res_remote_ip +#: model:ir.model.fields,field_description:base_remote.field_res_remote__ip msgid "Ip" msgstr "" #. module: base_remote -#: model:ir.model.fields,field_description:base_remote.field_res_remote___last_update +#: model:ir.model.fields,field_description:base_remote.field_res_remote____last_update msgid "Last Modified on" msgstr "" #. module: base_remote -#: model:ir.model.fields,field_description:base_remote.field_res_remote_write_uid +#: model:ir.model.fields,field_description:base_remote.field_res_remote__write_uid msgid "Last Updated by" msgstr "" #. module: base_remote -#: model:ir.model.fields,field_description:base_remote.field_res_remote_write_date +#: model:ir.model.fields,field_description:base_remote.field_res_remote__write_date msgid "Last Updated on" msgstr "" #. module: base_remote -#: model:ir.ui.view,arch_db:base_remote.res_remote_form +#: model_terms:ir.ui.view,arch_db:base_remote.res_remote_form msgid "Remote" msgstr "" @@ -77,12 +82,12 @@ msgstr "" #: model:ir.actions.act_window,name:base_remote.res_remote_action #: model:ir.model,name:base_remote.model_res_remote #: model:ir.ui.menu,name:base_remote.res_remote_menu -#: model:ir.ui.view,arch_db:base_remote.res_remote_tree +#: model_terms:ir.ui.view,arch_db:base_remote.res_remote_tree msgid "Remotes" msgstr "" #. module: base_remote -#: model:ir.model.fields,help:base_remote.field_res_remote_in_network +#: model:ir.model.fields,help:base_remote.field_res_remote__in_network msgid "Shows if the remote can be found through the socket" msgstr "" @@ -91,8 +96,3 @@ msgstr "" msgid "Users" msgstr "" -#. module: base_remote -#: model:ir.model,name:base_remote.model_base -msgid "base" -msgstr "" - diff --git a/base_remote/models/base.py b/base_remote/models/base.py index b7c9b2fc6..c534ad13e 100644 --- a/base_remote/models/base.py +++ b/base_remote/models/base.py @@ -12,8 +12,6 @@ class Base(models.AbstractModel): def remote(self): try: remote_addr = current_thread().environ["REMOTE_ADDR"] - except KeyError: - return self.env['res.remote'] - except AttributeError: + except (KeyError, AttributeError): return self.env['res.remote'] return self.env['res.remote']._get_remote(remote_addr) diff --git a/base_remote/models/res_remote.py b/base_remote/models/res_remote.py index bd90ee4fe..0abc850da 100644 --- a/base_remote/models/res_remote.py +++ b/base_remote/models/res_remote.py @@ -40,7 +40,7 @@ class ResRemote(models.Model): except socket.herror: logging.warning('Remote with ip %s could not be found' % addr) hostname = False - remote = self.search([('name', '=ilike', hostname or addr)]) + remote = self.search([('name', '=', hostname or addr)]) if not remote: remote = self.create(self._create_vals(addr, hostname)) if remote.ip != addr: diff --git a/base_remote/models/res_users.py b/base_remote/models/res_users.py index 77fab1b6e..50996a77e 100644 --- a/base_remote/models/res_users.py +++ b/base_remote/models/res_users.py @@ -3,7 +3,9 @@ from threading import current_thread from odoo import api, models, SUPERUSER_ID +from odoo.exceptions import AccessDenied from odoo.service import wsgi_server +from odoo.tools import config class ResUsers(models.Model): @@ -29,9 +31,13 @@ class ResUsers(models.Model): with cls.pool.cursor() as cr: env = api.Environment(cr, SUPERUSER_ID, {}) remote = env["res.users"].remote - if remote: + if not config['test_enable']: remote.ensure_one() - return method() + result = method() + if not result: + # Force exception to record auth failure + raise AccessDenied() + return result # Override all auth-related core methods @classmethod diff --git a/base_remote/readme/CONTRIBUTORS.rst b/base_remote/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..93ec993e0 --- /dev/null +++ b/base_remote/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Enric Tobella diff --git a/base_remote/readme/DESCRIPTION.rst b/base_remote/readme/DESCRIPTION.rst new file mode 100644 index 000000000..01d99917a --- /dev/null +++ b/base_remote/readme/DESCRIPTION.rst @@ -0,0 +1,2 @@ +This module allows to store all the connected remotes (external ip addresses) to Odoo. +It should be used with other modules in order to check remote's configurations. \ No newline at end of file diff --git a/base_remote/readme/USAGE.rst b/base_remote/readme/USAGE.rst new file mode 100644 index 000000000..52ab7c552 --- /dev/null +++ b/base_remote/readme/USAGE.rst @@ -0,0 +1,3 @@ +When installed, all remotes will be stored by `hostname` on `res.remote`. +They can be viewed on `Settings / Remotes`. +The last IP of the remote will be stored. diff --git a/base_remote/static/description/index.html b/base_remote/static/description/index.html new file mode 100644 index 000000000..ebdb73884 --- /dev/null +++ b/base_remote/static/description/index.html @@ -0,0 +1,427 @@ + + + + + + +Remote Base + + + +
+

Remote Base

+ + +

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

+

This module allows to store all the connected remotes (external ip addresses) to Odoo. +It should be used with other modules in order to check remote’s configurations.

+

Table of contents

+ +
+

Usage

+

When installed, all remotes will be stored by hostname on res.remote. +They can be viewed on Settings / Remotes. +The last IP of the remote will be stored.

+
+
+

Bug Tracker

+

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

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Creu Blanca
  • +
+
+
+

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

+

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

+
+
+
+ + diff --git a/base_remote/tests/test_remote.py b/base_remote/tests/test_remote.py index 33876950d..4eaa0b08b 100644 --- a/base_remote/tests/test_remote.py +++ b/base_remote/tests/test_remote.py @@ -17,8 +17,7 @@ from odoo.tests.common import at_install, HttpCase, post_install class TestRemote(HttpCase): def setUp(self): super().setUp() - # HACK https://github.com/odoo/odoo/issues/24183 - # TODO Remove in v12 + # Complex password to avoid conflicts with `password_security` self.good_password = "Admin$%02584" self.data_demo = {