Browse Source

Merge pull request #1182 from yelizariev/11.0-mig-dbfilter_from_header

11.0 mig dbfilter from header
pull/1216/head
Pedro M. Baeza 7 years ago
committed by GitHub
parent
commit
6ed179389d
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 80
      dbfilter_from_header/README.rst
  2. 2
      dbfilter_from_header/__init__.py
  3. 28
      dbfilter_from_header/__manifest__.py
  4. 16
      dbfilter_from_header/i18n/dbfilter_from_header.pot
  5. 21
      dbfilter_from_header/override.py
  6. BIN
      dbfilter_from_header/static/description/icon.png

80
dbfilter_from_header/README.rst

@ -0,0 +1,80 @@
.. 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
====================
dbfilter_from_header
====================
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.
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 ``load`` parameter in ``/etc/odoo.conf`` or with the
``--load`` command-line parameter
``load = "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]``
Bug Tracker
===========
Bugs are tracked on `GitHub Issues
<https://github.com/OCA/server-tools/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.
Credits
=======
Contributors
------------
* Stéphane Bidoul <stephane.bidoul@acsone.eu>
* Yannick Vaucher <yannick.vaucher@camptocamp.com>
* Alexandre Fayolle <alexandre.fayolle@camptocamp.com>
* Holger Brunn <hbrunn@therp.nl>
* Laurent Mignon (aka lmi) <laurent.mignon@acsone.eu>
* Sandy Carter <sandy.carter@savoirfairelinux.com>
* Fabio Vilchez <fabio.vilchez@clearcorp.co.cr>
* Jos De Graeve <Jos.DeGraeve@apertoso.be>
* Lai Tim Siu (Quaritle Limited) <info@quartile.co>
Maintainer
----------
.. 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.

2
dbfilter_from_header/__init__.py

@ -0,0 +1,2 @@
from . import override

28
dbfilter_from_header/__manifest__.py

@ -0,0 +1,28 @@
# © 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": "11.0.1.0.0",
"author": "Therp BV,Odoo Community Association (OCA)",
"license": "AGPL-3",
"complexity": "normal",
"category": "Tools",
"depends": [
'web',
],
"data": [
],
"js": [
],
"css": [
],
"auto_install": False,
'installable': True,
"external_dependencies": {
'python': [],
},
}

16
dbfilter_from_header/i18n/dbfilter_from_header.pot

@ -0,0 +1,16 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 7.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-03-14 17:40+0000\n"
"PO-Revision-Date: 2014-03-14 17:40+0000\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"

21
dbfilter_from_header/override.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).
import re
from odoo import http
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
http.db_filter = db_filter

BIN
dbfilter_from_header/static/description/icon.png

After

Width: 128  |  Height: 128  |  Size: 9.2 KiB

Loading…
Cancel
Save