diff options
| author | Simon Lejeune <sle@openerp.com> | 2016-07-20 12:23:58 +0200 |
|---|---|---|
| committer | Simon Lejeune <sle@openerp.com> | 2016-07-20 14:16:01 +0200 |
| commit | d1cd293ecefde56bf649aa69b5da808755f6a4b8 (patch) | |
| tree | d5a133b37f617b5407e8c02025ca58e5bc1cf14d /addons/web | |
| parent | 6ef1644a7b3812f4cc0d066ea74970791a4b4d54 (diff) | |
[FIX] web: session_info: introduce `is_superuser` key
This is done in order to enable the tour service only for the
superuser. Commit 6ef1644a7b3812 changed the meaning of `is_admin`
to achieve this but broke the fact that some features of the debug
manager are available to admin and not only to the superuser. Anyway
a `is_admin` key should mean that the user is in the admin group.
We could have checked client side that the uid is equal to 1 but
adding a `is_superuser` key is more elegant and easier to grep.
Also fix the only occurence of a uid check in the weblcient.
This reverts commit 6ef1644a7b3812f4cc0d066ea74970791a4b4d54.
Diffstat (limited to 'addons/web')
| -rw-r--r-- | addons/web/models/ir_http.py | 3 | ||||
| -rw-r--r-- | addons/web/static/src/js/web_client.js | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/addons/web/models/ir_http.py b/addons/web/models/ir_http.py index 2b4b7509b52..0c3aacc09c9 100644 --- a/addons/web/models/ir_http.py +++ b/addons/web/models/ir_http.py @@ -21,7 +21,8 @@ class Http(models.AbstractModel): return { "session_id": request.session_id, "uid": request.session.uid, - "is_admin": request.env.uid == openerp.SUPERUSER_ID, + "is_admin": request.env.user.has_group('base.group_system'), + "is_superuser": request.env.user._is_superuser(), "user_context": request.session.get_context() if request.session.uid else {}, "db": request.session.db, "server_version": version_info.get('server_version'), diff --git a/addons/web/static/src/js/web_client.js b/addons/web/static/src/js/web_client.js index 99237dccc6c..5fc1f3f2796 100644 --- a/addons/web/static/src/js/web_client.js +++ b/addons/web/static/src/js/web_client.js @@ -62,7 +62,7 @@ return AbstractWebClient.extend({ var company = session.company_id; var img = session.url('/web/binary/company_logo' + '?db=' + session.db + (company ? '&company=' + company : '')); this.$('.oe_logo img').attr('src', '').attr('src', img); - this.$('.oe_logo_edit').toggleClass('oe_logo_edit_admin', session.uid === 1); + this.$('.oe_logo_edit').toggleClass('oe_logo_edit_admin', session.is_superuser); }, logo_edit: function(ev) { var self = this; |
