[ADD] - cherry picked 5737ebc

Signed-off-by: Carmen Bianca Bakker <carmen@coopiteasy.be>
pull/2425/head
Stéphane Bidoul 2015-11-18 22:16:10 +01:00 committed by Carmen Bianca Bakker
parent 77a7bfda1d
commit 4c22a340d8
No known key found for this signature in database
GPG Key ID: 76EBA6F6B6EA2EC9
2 changed files with 8 additions and 4 deletions

View File

@ -28,9 +28,12 @@ db_filter_org = http.db_filter
def db_filter(dbs, httprequest=None): def db_filter(dbs, httprequest=None):
dbs = db_filter_org(dbs, httprequest) dbs = db_filter_org(dbs, httprequest)
httprequest = httprequest or http.request.httprequest httprequest = httprequest or http.request.httprequest
db_filter_hdr = \ db_filter_hdr_odoo = httprequest.environ.get('HTTP_X_ODOO_DBFILTER')
httprequest.environ.get('HTTP_X_ODOO_DBFILTER') or \ db_filter_hdr_openerp = httprequest.environ.get('HTTP_X_OPENERP_DBFILTER')
httprequest.environ.get('HTTP_X_OPENERP_DBFILTER') if db_filter_hdr_odoo and db_filter_hdr_openerp:
raise RuntimeError("x-odoo-dbfilter and x-openerp-dbfiter "
"are both set")
db_filter_hdr = db_filter_hdr_odoo or db_filter_hdr_openerp
if db_filter_hdr: if db_filter_hdr:
dbs = [db for db in dbs if re.match(db_filter_hdr, db)] dbs = [db for db in dbs if re.match(db_filter_hdr, db)]
return dbs return dbs

View File

@ -30,8 +30,9 @@
This is interesting for setups where database names can't be mapped to This is interesting for setups where database names can't be mapped to
proxied host names. proxied host names.
In nginx, use In nginx, use one of
proxy_set_header X-OpenERP-dbfilter [your filter]; proxy_set_header X-OpenERP-dbfilter [your filter];
proxy_set_header X-Odoo-dbfilter [your filter];
The addon has to be loaded as server-wide module. The addon has to be loaded as server-wide module.
""", """,