diff --git a/dbfilter_from_header/README.rst b/dbfilter_from_header/README.rst new file mode 100644 index 000000000..f87147be1 --- /dev/null +++ b/dbfilter_from_header/README.rst @@ -0,0 +1,122 @@ +==================== +dbfilter_from_header +==================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! 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/dbfilter_from_header + :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-dbfilter_from_header + :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 addon lets you pass a dbfilter as a HTTP header. + +This is interesting for setups where database names can't be mapped to proxied host names. + +**Table of contents** + +.. contents:: + :local: + +Installation +============ + +To install this module, you only need to add it to your addons, and load it as +a server-wide module. + +This can be done with the ``server_wide_modules`` parameter in ``/etc/odoo.conf`` +or with the ``--load`` command-line parameter + +``server_wide_modules = "web, dbfilter_from_header"`` + +Configuration +============= + +Please keep in mind that the standard odoo dbfilter configuration is still +applied before looking at the regular expression in the header. + +* For nginx, use: + + ``proxy_set_header X-Odoo-dbfilter [your filter regex];`` + +* For caddy, use: + + ``proxy_header X-Odoo-dbfilter [your filter regex]`` + +* For Apache, use: + + ``RequestHeader set X-Odoo-dbfilter [your filter regex]`` + +And make sure that proxy mode is enabled in Odoo's configuration file: + +``proxy_mode = True`` + +Usage +===== + +To use this module, you need to complete installation and configuration +parts. + +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 +~~~~~~~ + +* Therp BV + +Contributors +~~~~~~~~~~~~ + +* Stéphane Bidoul +* Yannick Vaucher +* Alexandre Fayolle +* Holger Brunn +* Laurent Mignon (aka lmi) +* Sandy Carter +* Fabio Vilchez +* Jos De Graeve +* Lai Tim Siu (Quaritle Limited) + +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-tools `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/dbfilter_from_header/__init__.py b/dbfilter_from_header/__init__.py new file mode 100644 index 000000000..b57de876a --- /dev/null +++ b/dbfilter_from_header/__init__.py @@ -0,0 +1,2 @@ + +from . import override diff --git a/dbfilter_from_header/__manifest__.py b/dbfilter_from_header/__manifest__.py new file mode 100644 index 000000000..b9bd1e912 --- /dev/null +++ b/dbfilter_from_header/__manifest__.py @@ -0,0 +1,21 @@ +# © 2013 Therp BV +# © 2014 ACSONE SA/NV +# Copyright 2018 Quartile Limited +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +{ + "name": "dbfilter_from_header", + "summary": "Filter databases with HTTP headers", + "version": "12.0.1.0.0", + "website": "https://github.com/OCA/server-tools", + "author": "Therp BV, " + "Odoo Community Association (OCA)", + "license": "AGPL-3", + "complexity": "normal", + "category": "Tools", + "depends": [ + 'web', + ], + "auto_install": False, + 'installable': True, +} diff --git a/dbfilter_from_header/i18n/dbfilter_from_header.pot b/dbfilter_from_header/i18n/dbfilter_from_header.pot new file mode 100644 index 000000000..d2e396f15 --- /dev/null +++ b/dbfilter_from_header/i18n/dbfilter_from_header.pot @@ -0,0 +1,14 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.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" + diff --git a/dbfilter_from_header/override.py b/dbfilter_from_header/override.py new file mode 100644 index 000000000..113acb6a0 --- /dev/null +++ b/dbfilter_from_header/override.py @@ -0,0 +1,27 @@ +# © 2013 Therp BV +# © 2014 ACSONE SA/NV +# Copyright 2018 Quartile Limited +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +import logging +import re +from odoo import http +from odoo.tools import config + +db_filter_org = http.db_filter + + +def db_filter(dbs, httprequest=None): + dbs = db_filter_org(dbs, httprequest) + httprequest = httprequest or http.request.httprequest + db_filter_hdr = httprequest.environ.get('HTTP_X_ODOO_DBFILTER') + if db_filter_hdr: + dbs = [db for db in dbs if re.match(db_filter_hdr, db)] + return dbs + + +if config.get('proxy_mode') and \ + 'dbfilter_from_header' in config.get('server_wide_modules'): + _logger = logging.getLogger(__name__) + _logger.info('monkey patching http.db_filter') + http.db_filter = db_filter diff --git a/dbfilter_from_header/readme/CONFIGURE.rst b/dbfilter_from_header/readme/CONFIGURE.rst new file mode 100644 index 000000000..11da21c49 --- /dev/null +++ b/dbfilter_from_header/readme/CONFIGURE.rst @@ -0,0 +1,18 @@ +Please keep in mind that the standard odoo dbfilter configuration is still +applied before looking at the regular expression in the header. + +* For nginx, use: + + ``proxy_set_header X-Odoo-dbfilter [your filter regex];`` + +* For caddy, use: + + ``proxy_header X-Odoo-dbfilter [your filter regex]`` + +* For Apache, use: + + ``RequestHeader set X-Odoo-dbfilter [your filter regex]`` + +And make sure that proxy mode is enabled in Odoo's configuration file: + +``proxy_mode = True`` diff --git a/dbfilter_from_header/readme/CONTRIBUTORS.rst b/dbfilter_from_header/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..3ce1edb3a --- /dev/null +++ b/dbfilter_from_header/readme/CONTRIBUTORS.rst @@ -0,0 +1,9 @@ +* Stéphane Bidoul +* Yannick Vaucher +* Alexandre Fayolle +* Holger Brunn +* Laurent Mignon (aka lmi) +* Sandy Carter +* Fabio Vilchez +* Jos De Graeve +* Lai Tim Siu (Quaritle Limited) diff --git a/dbfilter_from_header/readme/DESCRIPTION.rst b/dbfilter_from_header/readme/DESCRIPTION.rst new file mode 100644 index 000000000..8f058402a --- /dev/null +++ b/dbfilter_from_header/readme/DESCRIPTION.rst @@ -0,0 +1,3 @@ +This addon lets you pass a dbfilter as a HTTP header. + +This is interesting for setups where database names can't be mapped to proxied host names. diff --git a/dbfilter_from_header/readme/INSTALL.rst b/dbfilter_from_header/readme/INSTALL.rst new file mode 100644 index 000000000..07de52fd3 --- /dev/null +++ b/dbfilter_from_header/readme/INSTALL.rst @@ -0,0 +1,7 @@ +To install this module, you only need to add it to your addons, and load it as +a server-wide module. + +This can be done with the ``server_wide_modules`` parameter in ``/etc/odoo.conf`` +or with the ``--load`` command-line parameter + +``server_wide_modules = "web, dbfilter_from_header"`` diff --git a/dbfilter_from_header/readme/USAGE.rst b/dbfilter_from_header/readme/USAGE.rst new file mode 100644 index 000000000..873c97460 --- /dev/null +++ b/dbfilter_from_header/readme/USAGE.rst @@ -0,0 +1,2 @@ +To use this module, you need to complete installation and configuration +parts. diff --git a/dbfilter_from_header/static/description/icon.png b/dbfilter_from_header/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/dbfilter_from_header/static/description/icon.png differ diff --git a/dbfilter_from_header/static/description/index.html b/dbfilter_from_header/static/description/index.html new file mode 100644 index 000000000..b794c1163 --- /dev/null +++ b/dbfilter_from_header/static/description/index.html @@ -0,0 +1,462 @@ + + + + + + +dbfilter_from_header + + + +
+

dbfilter_from_header

+ + +

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

+

This addon lets you pass a dbfilter as a HTTP header.

+

This is interesting for setups where database names can’t be mapped to proxied host names.

+

Table of contents

+ +
+

Installation

+

To install this module, you only need to add it to your addons, and load it as +a server-wide module.

+

This can be done with the server_wide_modules parameter in /etc/odoo.conf +or with the --load command-line parameter

+

server_wide_modules = "web, dbfilter_from_header"

+
+
+

Configuration

+

Please keep in mind that the standard odoo dbfilter configuration is still +applied before looking at the regular expression in the header.

+
    +
  • For nginx, use:

    +

    proxy_set_header X-Odoo-dbfilter [your filter regex];

    +
  • +
  • For caddy, use:

    +

    proxy_header X-Odoo-dbfilter [your filter regex]

    +
  • +
  • For Apache, use:

    +

    RequestHeader set X-Odoo-dbfilter [your filter regex]

    +
  • +
+

And make sure that proxy mode is enabled in Odoo’s configuration file:

+

proxy_mode = True

+
+
+

Usage

+

To use this module, you need to complete installation and configuration +parts.

+
+
+

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

+
    +
  • Therp BV
  • +
+
+
+

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/setup/_metapackage/VERSION.txt b/setup/_metapackage/VERSION.txt index 4a5988c19..1e7b7833d 100644 --- a/setup/_metapackage/VERSION.txt +++ b/setup/_metapackage/VERSION.txt @@ -1 +1 @@ -12.0.20190723.0 \ No newline at end of file +12.0.20190729.0 \ No newline at end of file diff --git a/setup/_metapackage/setup.py b/setup/_metapackage/setup.py index 1eda30b63..851af7bdc 100644 --- a/setup/_metapackage/setup.py +++ b/setup/_metapackage/setup.py @@ -18,6 +18,7 @@ setuptools.setup( 'odoo12-addon-base_technical_user', 'odoo12-addon-database_cleanup', 'odoo12-addon-datetime_formatter', + 'odoo12-addon-dbfilter_from_header', 'odoo12-addon-excel_import_export', 'odoo12-addon-excel_import_export_demo', 'odoo12-addon-fetchmail_notify_error_to_sender', diff --git a/setup/dbfilter_from_header/odoo/addons/dbfilter_from_header b/setup/dbfilter_from_header/odoo/addons/dbfilter_from_header new file mode 120000 index 000000000..261765463 --- /dev/null +++ b/setup/dbfilter_from_header/odoo/addons/dbfilter_from_header @@ -0,0 +1 @@ +../../../../dbfilter_from_header \ No newline at end of file diff --git a/setup/dbfilter_from_header/setup.py b/setup/dbfilter_from_header/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/dbfilter_from_header/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)