summaryrefslogtreecommitdiff
path: root/addons/base_setup
diff options
context:
space:
mode:
authorDamien Bouvy <dbo@odoo.com>2019-11-12 18:50:34 +0000
committerDamien Bouvy <dbo@odoo.com>2019-12-02 09:21:32 +0000
commitd2b02cab298351869986eb8d0c959fcd909f90aa (patch)
tree1a9ad6698111a588aca7e07ed3f98a6c00b62db3 /addons/base_setup
parenta7a9362e079bbe567d51504aa29d3833323972b8 (diff)
[FIX] web,(various): don't pollute session_info for portal users
The `session_info` dictionnary is used to bootstrap some JS code client side (usually in the backend). It includes relevant information, such as some parameters key for the OdooBot onboarding, the Enterprise subscription expiration alert, etc. to avoid triggering a lot of RPC calls upon webclient start. `session_info` is also called by the remote authentication mechanism located at `/web/session/authenticate`, which can be used by external mechanism to obtain a valid session remotely. Revision odoo/odoo@8a28cc2 introduced the concept of cache keys for some oft-requested data (such as menus, translations and dynamic qweb templates) to avoid requesting them on each webclient start, since they tend not to change often. Unfortunately, it introduced a read on the ir.ui.menu model that raised an `AccessError` if the authenticating user was not a member of the `base.group_user` group ('Internal' user type). While fixing that issue, it became apparent that `session_info` returns a whole lot of information through this remote connection route which is entirely unnecessary if not used in the context of a webclient start, such a currencies, the state of the enterprise subscription, etc. This commit fixes the access right issue by removing this non-relevant information from the returned dict (including cache keys) if the user is not an internal one. closes odoo/odoo#40770 X-original-commit: 6e99ac2c6cd5ca9af87b4fc7a3a1394359e30b02 Related: odoo/enterprise#6860 Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com>
Diffstat (limited to 'addons/base_setup')
-rw-r--r--addons/base_setup/models/ir_http.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/addons/base_setup/models/ir_http.py b/addons/base_setup/models/ir_http.py
index f65384adfc1..92639e3c1e2 100644
--- a/addons/base_setup/models/ir_http.py
+++ b/addons/base_setup/models/ir_http.py
@@ -9,5 +9,6 @@ class IrHttp(models.AbstractModel):
def session_info(self):
result = super(IrHttp, self).session_info()
- result['show_effect'] = request.env['ir.config_parameter'].sudo().get_param('base_setup.show_effect')
+ if request.env.user.has_group('base.group_user'):
+ result['show_effect'] = request.env['ir.config_parameter'].sudo().get_param('base_setup.show_effect')
return result