Browse Source

Merge pull request #1329 from nilshamerlinck/11.0_-_dbfilter_from_header_-_prevent_autoloading

[11.0][FIX] dbfilter_from_header: prevent autoloading
pull/1336/head
Pedro M. Baeza 6 years ago
committed by GitHub
parent
commit
2602f5934f
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      dbfilter_from_header/README.rst
  2. 8
      dbfilter_from_header/override.py

9
dbfilter_from_header/README.rst

@ -16,10 +16,10 @@ Installation
To install this module, you only need to add it to your addons, and load it as To install this module, you only need to add it to your addons, and load it as
a server-wide module. a server-wide module.
This can be done with the ``load`` parameter in ``/etc/odoo.conf`` or with the
``--load`` command-line parameter
This can be done with the ``server_wide_modules`` parameter in ``/etc/odoo.conf``
or with the ``--load`` command-line parameter
``load = "web, dbfilter_from_header"``
``server_wide_modules = "web, dbfilter_from_header"``
Configuration Configuration
============= =============
@ -39,6 +39,9 @@ applied before looking at the regular expression in the header.
``RequestHeader set X-Odoo-dbfilter [your filter regex]`` ``RequestHeader set X-Odoo-dbfilter [your filter regex]``
And make sure that proxy mode is enabled in Odoo's configuration file:
``proxy_mode = True``
Bug Tracker Bug Tracker
=========== ===========

8
dbfilter_from_header/override.py

@ -3,8 +3,10 @@
# Copyright 2018 Quartile Limited # Copyright 2018 Quartile Limited
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import logging
import re import re
from odoo import http from odoo import http
from odoo.tools import config
db_filter_org = http.db_filter db_filter_org = http.db_filter
@ -18,4 +20,8 @@ def db_filter(dbs, httprequest=None):
return dbs return dbs
http.db_filter = db_filter
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
Loading…
Cancel
Save