From fd7f90367ecdb998ac90139db7240990422f0256 Mon Sep 17 00:00:00 2001 From: Holger Brunn Date: Tue, 14 Jan 2014 14:24:48 +0100 Subject: [PATCH 1/8] [ADD] auth_from_http_basic --- auth_from_http_basic/__init__.py | 40 ++++++++++++++ auth_from_http_basic/__openerp__.py | 52 +++++++++++++++++++ auth_from_http_basic/static/src/img/icon.png | Bin 0 -> 1142 bytes 3 files changed, 92 insertions(+) create mode 100644 auth_from_http_basic/__init__.py create mode 100644 auth_from_http_basic/__openerp__.py create mode 100644 auth_from_http_basic/static/src/img/icon.png diff --git a/auth_from_http_basic/__init__.py b/auth_from_http_basic/__init__.py new file mode 100644 index 000000000..26fa1ad00 --- /dev/null +++ b/auth_from_http_basic/__init__.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# This module copyright (C) 2014 Therp BV (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## +from openerp.addons.web.http import WebRequest +from openerp.addons.web.controllers.main import db_list + +old_init = WebRequest.init + +def init(self, params): + old_init(self, params) + if self.httprequest.authorization and not self.session._login: + dbs = db_list(self) + self.session.authenticate( + dbs and dbs[0], + self.httprequest.authorization.username, + self.httprequest.authorization.password, + dict( + base_location=self.httprequest.url_root.rstrip('/'), + HTTP_HOST=self.httprequest.environ['HTTP_HOST'], + REMOTE_ADDR=self.httprequest.environ['REMOTE_ADDR'] + )) + +WebRequest.init = init diff --git a/auth_from_http_basic/__openerp__.py b/auth_from_http_basic/__openerp__.py new file mode 100644 index 000000000..461dd3385 --- /dev/null +++ b/auth_from_http_basic/__openerp__.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# This module copyright (C) 2014 Therp BV (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## +{ + "name" : "Authenticate via HTTP basic authentication", + "version" : "1.0", + "author" : "Therp BV", + "complexity": "expert", + "description": """ +In an environment where several web applications authenticate against the same +source, the simplest way to attain single sign on would be to have the +webserver handle authentication and pass the login information via HTTP headers +to the application it proxies. + +This addon allows for this setup. Technically, it picks up the HTTP +Authorization header, extract a username and a password from that and tries to +login into the first database found in the database list. + """, + "category" : "", + "depends" : [ + ], + "data" : [ + ], + "js": [ + ], + "css": [ + ], + "qweb": [ + ], + "auto_install": False, + "installable": True, + "external_dependencies" : { + 'python' : [], + }, +} diff --git a/auth_from_http_basic/static/src/img/icon.png b/auth_from_http_basic/static/src/img/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..4c7ab302908e114888446d84d3493fa726033c1f GIT binary patch literal 1142 zcmeAS@N?(olHy`uVBq!ia0vp^0U*r53?z4+XPOVBSkfJR9T^xl_H+M9WCijWi-X*q z7}lMWc?skwBzpw;GB8xBF)%c=FfjZA3N^f7U???UV0e|lz+g3lfkC`r&aOZkpuXS$ zpAc7|0+Vy!%`Sd3J@*~Rz=H@Xz@vBMNCCrhU++~OAXQKjgnPb5^?zLm6yRy4l)f7mx|d; zx?*(k%?4)UEmyi0Ecrc2=k&YFn|8nX@qd4)(saLN%zo##oL4V9SpH%8W(I{5_Kby- zneS~VhopAyb6lBS&$U5E`gKppbdV7NQIC+SE zKe2ts8LoR*Hw$jqcIEDHSU_mi4;HoUDLTgOJMIHx zO|`@|q9i4;B-JXpC>2OC7#SEE>l#?<8d`)H8e5qfSQ#5>8yHy`7 Date: Tue, 14 Jan 2014 14:57:03 +0100 Subject: [PATCH 2/8] [FIX] compatibility with dbfilter_from_header [ADD] mention dbfilter_from_header in the module description --- auth_from_http_basic/__init__.py | 4 ++-- auth_from_http_basic/__openerp__.py | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/auth_from_http_basic/__init__.py b/auth_from_http_basic/__init__.py index 26fa1ad00..4a12fa791 100644 --- a/auth_from_http_basic/__init__.py +++ b/auth_from_http_basic/__init__.py @@ -19,14 +19,14 @@ # ############################################################################## from openerp.addons.web.http import WebRequest -from openerp.addons.web.controllers.main import db_list +from openerp.addons.web.controllers import main as web_main old_init = WebRequest.init def init(self, params): old_init(self, params) if self.httprequest.authorization and not self.session._login: - dbs = db_list(self) + dbs = web_main.db_list(self) self.session.authenticate( dbs and dbs[0], self.httprequest.authorization.username, diff --git a/auth_from_http_basic/__openerp__.py b/auth_from_http_basic/__openerp__.py index 461dd3385..2b38960bb 100644 --- a/auth_from_http_basic/__openerp__.py +++ b/auth_from_http_basic/__openerp__.py @@ -30,8 +30,11 @@ webserver handle authentication and pass the login information via HTTP headers to the application it proxies. This addon allows for this setup. Technically, it picks up the HTTP -Authorization header, extract a username and a password from that and tries to -login into the first database found in the database list. +Authorization header, extracts a username and a password and tries to login +into the first database found in the database list. + +If you have to set a specific database, possibly depending on the login +provided, use the addon dbfilter_from_header. """, "category" : "", "depends" : [ From 92a1c0568bf9d4030a41e163acd6715bcd571fec Mon Sep 17 00:00:00 2001 From: Holger Brunn Date: Wed, 15 Jan 2014 10:28:43 +0100 Subject: [PATCH 3/8] [FIX] remove static directory for know side effect of triggering the monkey patch [IMP] clarify in the manifest file the the addon has to be loaded as a server-wide module --- auth_from_http_basic/__openerp__.py | 2 ++ auth_from_http_basic/static/src/img/icon.png | Bin 1142 -> 0 bytes 2 files changed, 2 insertions(+) delete mode 100644 auth_from_http_basic/static/src/img/icon.png diff --git a/auth_from_http_basic/__openerp__.py b/auth_from_http_basic/__openerp__.py index 2b38960bb..0af4fa2ee 100644 --- a/auth_from_http_basic/__openerp__.py +++ b/auth_from_http_basic/__openerp__.py @@ -35,6 +35,8 @@ into the first database found in the database list. If you have to set a specific database, possibly depending on the login provided, use the addon dbfilter_from_header. + +The addon has to be loaded as server-wide module. """, "category" : "", "depends" : [ diff --git a/auth_from_http_basic/static/src/img/icon.png b/auth_from_http_basic/static/src/img/icon.png deleted file mode 100644 index 4c7ab302908e114888446d84d3493fa726033c1f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1142 zcmeAS@N?(olHy`uVBq!ia0vp^0U*r53?z4+XPOVBSkfJR9T^xl_H+M9WCijWi-X*q z7}lMWc?skwBzpw;GB8xBF)%c=FfjZA3N^f7U???UV0e|lz+g3lfkC`r&aOZkpuXS$ zpAc7|0+Vy!%`Sd3J@*~Rz=H@Xz@vBMNCCrhU++~OAXQKjgnPb5^?zLm6yRy4l)f7mx|d; zx?*(k%?4)UEmyi0Ecrc2=k&YFn|8nX@qd4)(saLN%zo##oL4V9SpH%8W(I{5_Kby- zneS~VhopAyb6lBS&$U5E`gKppbdV7NQIC+SE zKe2ts8LoR*Hw$jqcIEDHSU_mi4;HoUDLTgOJMIHx zO|`@|q9i4;B-JXpC>2OC7#SEE>l#?<8d`)H8e5qfSQ#5>8yHy`7 Date: Fri, 17 Jan 2014 20:57:27 +0100 Subject: [PATCH 4/8] [ADD] logout function --- auth_from_http_basic/__init__.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/auth_from_http_basic/__init__.py b/auth_from_http_basic/__init__.py index 4a12fa791..0f0a6e46c 100644 --- a/auth_from_http_basic/__init__.py +++ b/auth_from_http_basic/__init__.py @@ -18,7 +18,7 @@ # along with this program. If not, see . # ############################################################################## -from openerp.addons.web.http import WebRequest +from openerp.addons.web.http import WebRequest, JsonRequest from openerp.addons.web.controllers import main as web_main old_init = WebRequest.init @@ -38,3 +38,16 @@ def init(self, params): )) WebRequest.init = init + +old_dispatch = JsonRequest.dispatch + +def dispatch(self, method): + response = old_dispatch(self, method) + if method.im_func == web_main.Session.destroy.im_func: + response.status = '301 logout' + response.headers.add( + 'Location', + self.httprequest.url.replace('://', '://logout@')) + return response + +JsonRequest.dispatch = dispatch From c3d2924623350fee9ed6f1e6d055921e921b7e00 Mon Sep 17 00:00:00 2001 From: Holger Brunn Date: Sat, 18 Jan 2014 17:36:28 +0100 Subject: [PATCH 5/8] [ADD] auth_from_http_basic_logout --- auth_from_http_basic_logout/__init__.py | 20 +++++++ auth_from_http_basic_logout/__openerp__.py | 52 ++++++++++++++++++ .../i18n/auth_from_http_basic_logout.pot | 23 ++++++++ auth_from_http_basic_logout/i18n/nl.po | 23 ++++++++ .../static/src/img/icon.png | Bin 0 -> 1142 bytes .../src/js/auth_from_http_basic_logout.js | 48 ++++++++++++++++ 6 files changed, 166 insertions(+) create mode 100644 auth_from_http_basic_logout/__init__.py create mode 100644 auth_from_http_basic_logout/__openerp__.py create mode 100644 auth_from_http_basic_logout/i18n/auth_from_http_basic_logout.pot create mode 100644 auth_from_http_basic_logout/i18n/nl.po create mode 100644 auth_from_http_basic_logout/static/src/img/icon.png create mode 100644 auth_from_http_basic_logout/static/src/js/auth_from_http_basic_logout.js diff --git a/auth_from_http_basic_logout/__init__.py b/auth_from_http_basic_logout/__init__.py new file mode 100644 index 000000000..9dd152f93 --- /dev/null +++ b/auth_from_http_basic_logout/__init__.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# This module copyright (C) 2014 Therp BV (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## diff --git a/auth_from_http_basic_logout/__openerp__.py b/auth_from_http_basic_logout/__openerp__.py new file mode 100644 index 000000000..7f7b4812e --- /dev/null +++ b/auth_from_http_basic_logout/__openerp__.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# This module copyright (C) 2014 Therp BV (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## +{ + "name" : "Authenticate via HTTP basic authentication (logout helper)", + "version" : "1.0", + "author" : "Therp BV", + "complexity": "expert", + "description": """ +With auth_from_http_basic, the logout procedure has to be bent a bit to provide +a good user experience. As the former has to be a server wide module, this is +the clientside complement which provides the javascript part. + +The addon has to be installed in the database in use. + """, + "category" : "", + "depends" : [ + 'web', + 'auth_from_http_basic', + ], + "data" : [ + ], + "js": [ + 'static/src/js/auth_from_http_basic_logout.js', + ], + "css": [ + ], + "qweb": [ + ], + "auto_install": False, + "installable": True, + "external_dependencies" : { + 'python' : [], + }, +} diff --git a/auth_from_http_basic_logout/i18n/auth_from_http_basic_logout.pot b/auth_from_http_basic_logout/i18n/auth_from_http_basic_logout.pot new file mode 100644 index 000000000..5b21a40f1 --- /dev/null +++ b/auth_from_http_basic_logout/i18n/auth_from_http_basic_logout.pot @@ -0,0 +1,23 @@ +# 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-01-18 16:31+0000\n" +"PO-Revision-Date: 2014-01-18 16:31+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" + +#. module: auth_from_http_basic_logout +#. openerp-web +#: code:addons/auth_from_http_basic_logout/static/src/js/auth_from_http_basic_logout.js:37 +#, python-format +msgid "

You have been logged out successfully. Click here to log in again.

" +msgstr "" + diff --git a/auth_from_http_basic_logout/i18n/nl.po b/auth_from_http_basic_logout/i18n/nl.po new file mode 100644 index 000000000..6f40c46a9 --- /dev/null +++ b/auth_from_http_basic_logout/i18n/nl.po @@ -0,0 +1,23 @@ +# 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-01-18 16:31+0000\n" +"PO-Revision-Date: 2014-01-18 16:31+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" + +#. module: auth_from_http_basic_logout +#. openerp-web +#: code:addons/auth_from_http_basic_logout/static/src/js/auth_from_http_basic_logout.js:37 +#, python-format +msgid "

You have been logged out successfully. Click here to log in again.

" +msgstr "

U bent afgemeld. Klik hier om weer in te loggen.

" + diff --git a/auth_from_http_basic_logout/static/src/img/icon.png b/auth_from_http_basic_logout/static/src/img/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..4c7ab302908e114888446d84d3493fa726033c1f GIT binary patch literal 1142 zcmeAS@N?(olHy`uVBq!ia0vp^0U*r53?z4+XPOVBSkfJR9T^xl_H+M9WCijWi-X*q z7}lMWc?skwBzpw;GB8xBF)%c=FfjZA3N^f7U???UV0e|lz+g3lfkC`r&aOZkpuXS$ zpAc7|0+Vy!%`Sd3J@*~Rz=H@Xz@vBMNCCrhU++~OAXQKjgnPb5^?zLm6yRy4l)f7mx|d; zx?*(k%?4)UEmyi0Ecrc2=k&YFn|8nX@qd4)(saLN%zo##oL4V9SpH%8W(I{5_Kby- zneS~VhopAyb6lBS&$U5E`gKppbdV7NQIC+SE zKe2ts8LoR*Hw$jqcIEDHSU_mi4;HoUDLTgOJMIHx zO|`@|q9i4;B-JXpC>2OC7#SEE>l#?<8d`)H8e5qfSQ#5>8yHy`7). +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . +// +//############################################################################ + +openerp.auth_from_http_basic_logout = function(openerp) +{ + openerp.web.Session.include({ + session_logout: function() + { + var deferred = this._super(this, arguments); + deferred.fail(function(error, ev) + { + ev.preventDefault(); + openerp.web.blockUI(); + jQuery('.openerp_webclient_container').remove(); + jQuery('.oe_blockui_spin_container') + .empty() + .html( + _.string.sprintf( + openerp.web._t( + '

You have been logged out successfully. Click here to log in again.

') + )) + .click(function() + { + window.location.reload(); + }); + }); + return deferred; + } + }); +} From c82d4035e9a01c78cdad23bae50c91dd5c8e3560 Mon Sep 17 00:00:00 2001 From: Holger Brunn Date: Wed, 22 Jan 2014 09:29:07 +0100 Subject: [PATCH 6/8] [ADD] funder credits --- auth_from_http_basic/__openerp__.py | 5 +++++ auth_from_http_basic_logout/__openerp__.py | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/auth_from_http_basic/__openerp__.py b/auth_from_http_basic/__openerp__.py index 0af4fa2ee..a611a1fde 100644 --- a/auth_from_http_basic/__openerp__.py +++ b/auth_from_http_basic/__openerp__.py @@ -37,6 +37,11 @@ If you have to set a specific database, possibly depending on the login provided, use the addon dbfilter_from_header. The addon has to be loaded as server-wide module. + + +Funders: + +Open2bizz software & consultancy """, "category" : "", "depends" : [ diff --git a/auth_from_http_basic_logout/__openerp__.py b/auth_from_http_basic_logout/__openerp__.py index 7f7b4812e..9ab07b8f4 100644 --- a/auth_from_http_basic_logout/__openerp__.py +++ b/auth_from_http_basic_logout/__openerp__.py @@ -29,6 +29,11 @@ a good user experience. As the former has to be a server wide module, this is the clientside complement which provides the javascript part. The addon has to be installed in the database in use. + + +Funders: + +Open2bizz software & consultancy """, "category" : "", "depends" : [ From 0db61caf20974ec79e05a1f5bc607be10cde85a7 Mon Sep 17 00:00:00 2001 From: Holger Brunn Date: Wed, 22 Jan 2014 09:31:15 +0100 Subject: [PATCH 7/8] [FIX] replace therp icon by a generic one --- .../static/src/img/icon.png | Bin 1142 -> 7939 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/auth_from_http_basic_logout/static/src/img/icon.png b/auth_from_http_basic_logout/static/src/img/icon.png index 4c7ab302908e114888446d84d3493fa726033c1f..f1006195e0220e5b38e4a1b8f17870ec9359f7bb 100644 GIT binary patch literal 7939 zcmV+eAN=5nP)2wk@lR!X%5@omqLQoK55FAmjS7i{dSA3$P zzIWGpF5g@Fp8Bp&ukT*H4h$*?s1O4r5R!C8GIo+qce>N_R9$1&8TQ`qkF!s8b*BRX zFM%xBD`!=8)j6lCzVrQlzwbAk0Pn1K);sGwUgQlvKLcO_2muHHpa2{I;{b91Tmb5P z29UkM7bgIq6hIw-nE+}46zlg~00Mw~J2IC7-~bH$NT*>l2T%@R#m0?)eR5!6#2OkJ zwfYB!GR@7+>j2CG5T53^!gCw?B9pf=5U-V0hW_Ct8lY0mDpQ}2>K`4_@6BwQGxy!x zFigg|X_|rXefNE7LjfBLkK+J>1?MgU5GgSK^BzE^!K(t$w07-{?`dpoTmqm$|KO

>GG0jNr_StN-8L&uw?17%KDt|b@K@T5Q5>Mp~PoC{qdi)w6vVK?6S*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O; z1aSTBcYgK7d+z_Cy665MsxN%y2lt=Fv3NT$@U->FBkRSK!fqdcgml%9T*sY32vJgq tN6+Hech)=Wo%POoXT7uDS#R0({{b$rzUWE6E0F*I002ovPDHLkV1nr_+@t^i literal 1142 zcmeAS@N?(olHy`uVBq!ia0vp^0U*r53?z4+XPOVBSkfJR9T^xl_H+M9WCijWi-X*q z7}lMWc?skwBzpw;GB8xBF)%c=FfjZA3N^f7U???UV0e|lz+g3lfkC`r&aOZkpuXS$ zpAc7|0+Vy!%`Sd3J@*~Rz=H@Xz@vBMNCCrhU++~OAXQKjgnPb5^?zLm6yRy4l)f7mx|d; zx?*(k%?4)UEmyi0Ecrc2=k&YFn|8nX@qd4)(saLN%zo##oL4V9SpH%8W(I{5_Kby- zneS~VhopAyb6lBS&$U5E`gKppbdV7NQIC+SE zKe2ts8LoR*Hw$jqcIEDHSU_mi4;HoUDLTgOJMIHx zO|`@|q9i4;B-JXpC>2OC7#SEE>l#?<8d`)H8e5qfSQ#5>8yHy`7 Date: Mon, 31 Mar 2014 12:06:13 +0200 Subject: [PATCH 8/8] [FIX] pep8 --- auth_from_http_basic/__init__.py | 18 ++++++++++-------- auth_from_http_basic/__openerp__.py | 16 ++++++++-------- auth_from_http_basic_logout/__openerp__.py | 16 ++++++++-------- 3 files changed, 26 insertions(+), 24 deletions(-) diff --git a/auth_from_http_basic/__init__.py b/auth_from_http_basic/__init__.py index 0f0a6e46c..34a0d9550 100644 --- a/auth_from_http_basic/__init__.py +++ b/auth_from_http_basic/__init__.py @@ -23,24 +23,26 @@ from openerp.addons.web.controllers import main as web_main old_init = WebRequest.init + def init(self, params): old_init(self, params) if self.httprequest.authorization and not self.session._login: dbs = web_main.db_list(self) self.session.authenticate( - dbs and dbs[0], - self.httprequest.authorization.username, - self.httprequest.authorization.password, - dict( - base_location=self.httprequest.url_root.rstrip('/'), - HTTP_HOST=self.httprequest.environ['HTTP_HOST'], - REMOTE_ADDR=self.httprequest.environ['REMOTE_ADDR'] - )) + dbs and dbs[0], + self.httprequest.authorization.username, + self.httprequest.authorization.password, + dict( + base_location=self.httprequest.url_root.rstrip('/'), + HTTP_HOST=self.httprequest.environ['HTTP_HOST'], + REMOTE_ADDR=self.httprequest.environ['REMOTE_ADDR'] + )) WebRequest.init = init old_dispatch = JsonRequest.dispatch + def dispatch(self, method): response = old_dispatch(self, method) if method.im_func == web_main.Session.destroy.im_func: diff --git a/auth_from_http_basic/__openerp__.py b/auth_from_http_basic/__openerp__.py index a611a1fde..4de914cfa 100644 --- a/auth_from_http_basic/__openerp__.py +++ b/auth_from_http_basic/__openerp__.py @@ -19,9 +19,9 @@ # ############################################################################## { - "name" : "Authenticate via HTTP basic authentication", - "version" : "1.0", - "author" : "Therp BV", + "name": "Authenticate via HTTP basic authentication", + "version": "1.0", + "author": "Therp BV", "complexity": "expert", "description": """ In an environment where several web applications authenticate against the same @@ -43,10 +43,10 @@ Funders: Open2bizz software & consultancy """, - "category" : "", - "depends" : [ + "category": "", + "depends": [ ], - "data" : [ + "data": [ ], "js": [ ], @@ -56,7 +56,7 @@ Open2bizz software & consultancy ], "auto_install": False, "installable": True, - "external_dependencies" : { - 'python' : [], + "external_dependencies": { + 'python': [], }, } diff --git a/auth_from_http_basic_logout/__openerp__.py b/auth_from_http_basic_logout/__openerp__.py index 9ab07b8f4..e0f98dd8f 100644 --- a/auth_from_http_basic_logout/__openerp__.py +++ b/auth_from_http_basic_logout/__openerp__.py @@ -19,9 +19,9 @@ # ############################################################################## { - "name" : "Authenticate via HTTP basic authentication (logout helper)", - "version" : "1.0", - "author" : "Therp BV", + "name": "Authenticate via HTTP basic authentication (logout helper)", + "version": "1.0", + "author": "Therp BV", "complexity": "expert", "description": """ With auth_from_http_basic, the logout procedure has to be bent a bit to provide @@ -35,12 +35,12 @@ Funders: Open2bizz software & consultancy """, - "category" : "", - "depends" : [ + "category": "", + "depends": [ 'web', 'auth_from_http_basic', ], - "data" : [ + "data": [ ], "js": [ 'static/src/js/auth_from_http_basic_logout.js', @@ -51,7 +51,7 @@ Open2bizz software & consultancy ], "auto_install": False, "installable": True, - "external_dependencies" : { - 'python' : [], + "external_dependencies": { + 'python': [], }, }