Ivan Yelizariev
7 years ago
No known key found for this signature in database
GPG Key ID: B87954F73B65AC8A
4 changed files with
26 additions and
22 deletions
-
dbfilter_from_header/README.rst
-
dbfilter_from_header/__init__.py
-
dbfilter_from_header/__manifest__.py
-
dbfilter_from_header/override.py
|
@ -19,7 +19,7 @@ a server-wide module. |
|
|
This can be done with the ``load`` parameter in ``/etc/odoo.conf`` or with the |
|
|
This can be done with the ``load`` parameter in ``/etc/odoo.conf`` or with the |
|
|
``--load`` command-line parameter |
|
|
``--load`` command-line parameter |
|
|
|
|
|
|
|
|
``load = "web, web_kanban, dbfilter_from_header"`` |
|
|
|
|
|
|
|
|
``load = "web, dbfilter_from_header"`` |
|
|
|
|
|
|
|
|
Configuration |
|
|
Configuration |
|
|
============= |
|
|
============= |
|
@ -62,6 +62,7 @@ Contributors |
|
|
* Sandy Carter <sandy.carter@savoirfairelinux.com> |
|
|
* Sandy Carter <sandy.carter@savoirfairelinux.com> |
|
|
* Fabio Vilchez <fabio.vilchez@clearcorp.co.cr> |
|
|
* Fabio Vilchez <fabio.vilchez@clearcorp.co.cr> |
|
|
* Jos De Graeve <Jos.DeGraeve@apertoso.be> |
|
|
* Jos De Graeve <Jos.DeGraeve@apertoso.be> |
|
|
|
|
|
* Lai Tim Siu (Quaritle Limited) <info@quartile.co> |
|
|
|
|
|
|
|
|
Maintainer |
|
|
Maintainer |
|
|
---------- |
|
|
---------- |
|
|
|
@ -1,20 +1,2 @@ |
|
|
# -*- coding: utf-8 -*- |
|
|
|
|
|
# © 2013 Therp BV |
|
|
|
|
|
# © 2014 ACSONE SA/NV |
|
|
|
|
|
# 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 |
|
|
|
|
|
|
|
|
from . import override |
|
@ -1,12 +1,12 @@ |
|
|
# -*- coding: utf-8 -*- |
|
|
|
|
|
# © 2013 Therp BV |
|
|
# © 2013 Therp BV |
|
|
# © 2014 ACSONE SA/NV |
|
|
# © 2014 ACSONE SA/NV |
|
|
|
|
|
# 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). |
|
|
|
|
|
|
|
|
{ |
|
|
{ |
|
|
"name": "dbfilter_from_header", |
|
|
"name": "dbfilter_from_header", |
|
|
"summary": "Filter databases with HTTP headers", |
|
|
"summary": "Filter databases with HTTP headers", |
|
|
"version": "10.0.1.0.0", |
|
|
|
|
|
|
|
|
"version": "11.0.1.0.0", |
|
|
"author": "Therp BV,Odoo Community Association (OCA)", |
|
|
"author": "Therp BV,Odoo Community Association (OCA)", |
|
|
"license": "AGPL-3", |
|
|
"license": "AGPL-3", |
|
|
"complexity": "normal", |
|
|
"complexity": "normal", |
|
|
|
@ -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 |