Browse Source
Merge pull request #1327 from nilshamerlinck/9.0_-_dbfilter_from_header_-_prevent_autoloading
[9.0][FIX] dbfilter_from_header: prevent autoloading
pull/1563/head
Pedro M. Baeza
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
15 additions and
2 deletions
-
dbfilter_from_header/README.rst
-
dbfilter_from_header/__init__.py
|
|
@ -18,7 +18,14 @@ In nginx, use one of: |
|
|
|
* proxy_set_header X-OpenERP-dbfilter [your filter]; |
|
|
|
* proxy_set_header X-Odoo-dbfilter [your filter]; |
|
|
|
|
|
|
|
This addon has to be loaded as server-wide module. |
|
|
|
Make sure that proxy mode is enabled in Odoo's configuration file: |
|
|
|
|
|
|
|
`proxy_mode = True` |
|
|
|
|
|
|
|
And load module as a server-wide module, either via the ``--load`` command-line parameter |
|
|
|
or by the ``server_wide_modules`` parameter: |
|
|
|
|
|
|
|
``server_wide_modules = "web, web_kanban, dbfilter_from_header"`` |
|
|
|
|
|
|
|
Bug Tracker |
|
|
|
=========== |
|
|
|
|
|
@ -3,8 +3,10 @@ |
|
|
|
# © 2014 ACSONE SA/NV |
|
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|
|
|
|
|
|
|
import logging |
|
|
|
import re |
|
|
|
from openerp import http |
|
|
|
from openerp.tools import config |
|
|
|
|
|
|
|
db_filter_org = http.db_filter |
|
|
|
|
|
|
@ -22,4 +24,8 @@ def db_filter(dbs, httprequest=None): |
|
|
|
dbs = [db for db in dbs if re.match(db_filter_hdr, db)] |
|
|
|
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 |