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/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/icon.png b/base_remote/static/description/icon.png deleted file mode 100644 index 3a0328b51..000000000 Binary files a/base_remote/static/description/icon.png and /dev/null differ diff --git a/base_remote/static/description/index.html b/base_remote/static/description/index.html new file mode 100644 index 000000000..f2c707e35 --- /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 = {