← Back to team overview

openerp-community-reviewer team mailing list archive

[Merge] lp:~therp-nl/server-env-tools/6.1-web_base_url_freeze into lp:server-env-tools/6.1

 

Holger Brunn (Therp) has proposed merging lp:~therp-nl/server-env-tools/6.1-web_base_url_freeze into lp:server-env-tools/6.1.

Requested reviews:
  Server Environment And Tools Core Editors (server-env-tools-core-editors)

For more details, see:
https://code.launchpad.net/~therp-nl/server-env-tools/6.1-web_base_url_freeze/+merge/225651

When admin logs in, the parameter web.base.url is set to the url being used to
access the running instance. This can lead to problems when admin regularly
logs in via a SSH tunnel or a private IP.

In 7.0 upwards, this is fixed by adding the parameter web.base.url.freeze,
which disables this behavior if set.

This addon provides this functionality for 6.1 installations.
-- 
https://code.launchpad.net/~therp-nl/server-env-tools/6.1-web_base_url_freeze/+merge/225651
Your team Server Environment And Tools Core Editors is requested to review the proposed merge of lp:~therp-nl/server-env-tools/6.1-web_base_url_freeze into lp:server-env-tools/6.1.
=== added directory 'web_base_url_freeze'
=== added file 'web_base_url_freeze/__init__.py'
--- web_base_url_freeze/__init__.py	1970-01-01 00:00:00 +0000
+++ web_base_url_freeze/__init__.py	2014-07-04 12:11:46 +0000
@@ -0,0 +1,21 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    This module copyright (C) 2014 Therp BV (<http://therp.nl>).
+#
+#    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 <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+from . import model

=== added file 'web_base_url_freeze/__openerp__.py'
--- web_base_url_freeze/__openerp__.py	1970-01-01 00:00:00 +0000
+++ web_base_url_freeze/__openerp__.py	2014-07-04 12:11:46 +0000
@@ -0,0 +1,55 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    This module copyright (C) 2014 Therp BV (<http://therp.nl>).
+#
+#    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 <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+{
+    "name": "web.base.url.freeze for 6.1",
+    "version": "1.0",
+    "author": "Therp BV",
+    "license": "AGPL-3",
+    "complexity": "normal",
+    "description": """
+When admin logs in, the parameter web.base.url is set to the url being used to
+access the running instance. This can lead to problems when admin regularly
+logs in via a SSH tunnel or a private IP.
+
+In 7.0 upwards, this is fixed by adding the parameter web.base.url.freeze,
+which disables this behavior if set.
+
+This addon provides this functionality for 6.1 installations.
+    """,
+    "category": "Administration",
+    "depends": [
+        'base',
+    ],
+    "data": [
+    ],
+    "js": [
+    ],
+    "css": [
+    ],
+    "qweb": [
+    ],
+    "auto_install": False,
+    "installable": True,
+    "application": False,
+    "external_dependencies": {
+        'python': [],
+    },
+}

=== added directory 'web_base_url_freeze/model'
=== added file 'web_base_url_freeze/model/__init__.py'
--- web_base_url_freeze/model/__init__.py	1970-01-01 00:00:00 +0000
+++ web_base_url_freeze/model/__init__.py	2014-07-04 12:11:46 +0000
@@ -0,0 +1,21 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    This module copyright (C) 2014 Therp BV (<http://therp.nl>).
+#
+#    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 <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+from . import ir_config_parameter

=== added file 'web_base_url_freeze/model/ir_config_parameter.py'
--- web_base_url_freeze/model/ir_config_parameter.py	1970-01-01 00:00:00 +0000
+++ web_base_url_freeze/model/ir_config_parameter.py	2014-07-04 12:11:46 +0000
@@ -0,0 +1,38 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    This module copyright (C) 2014 Therp BV (<http://therp.nl>).
+#
+#    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 <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+from openerp.osv.orm import Model
+from openerp.osv import fields
+from openerp import SUPERUSER_ID
+
+
+class IrConfigParameter(Model):
+    _inherit = 'ir.config_parameter'
+
+    def set_param(self, cr, uid, key, value, context=None):
+        if uid == SUPERUSER_ID and key == 'web.base.url':
+            import traceback
+            stack = traceback.extract_stack()
+            if len(stack) > 1 and stack[-2][2] == 'authenticate':
+                if self.get_param(cr, uid, 'web.base.url.freeze',
+                                  context=context):
+                    return False
+        return super(IrConfigParameter, self).set_param(
+            cr, uid, key, value, context=context)

=== added directory 'web_base_url_freeze/static'
=== added directory 'web_base_url_freeze/static/src'
=== added directory 'web_base_url_freeze/static/src/img'
=== added file 'web_base_url_freeze/static/src/img/icon.png'
Binary files web_base_url_freeze/static/src/img/icon.png	1970-01-01 00:00:00 +0000 and web_base_url_freeze/static/src/img/icon.png	2014-07-04 12:11:46 +0000 differ

Follow ups