diff options
| author | Xavier Morel <xmo@odoo.com> | 2015-08-19 15:35:11 +0200 |
|---|---|---|
| committer | Xavier Morel <xmo@odoo.com> | 2015-08-20 09:42:06 +0200 |
| commit | e80f1152c79fd8d203c4bb591c8deefa08337368 (patch) | |
| tree | ce08b7e8f39c4ac669a9d72294702916e3912747 /addons/base_import_module | |
| parent | 992220eb4c475542d6513431f6f3a1732c872155 (diff) | |
[ADD] convenience res_users._is_admin
Checks that the provided user (or user in the provided dataset):
* is the superadmin
* or is a member of group_erp_manager
There are a number of hand-rolled "is_admin" checks in the codebase some
of which are fairly gnarly. The shortcut provides a single point of
contact, avoids forgetting about cases (e.g. SUPERUSER_ID) and is
relatively convenient when checking a user which is not the "current"
user.
closes #8146
Diffstat (limited to 'addons/base_import_module')
| -rw-r--r-- | addons/base_import_module/controllers/main.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/addons/base_import_module/controllers/main.py b/addons/base_import_module/controllers/main.py index d1c25544566..0d2cdc1ab5b 100644 --- a/addons/base_import_module/controllers/main.py +++ b/addons/base_import_module/controllers/main.py @@ -17,7 +17,7 @@ class ImportModule(Controller): def check_user(self, uid=None): if uid is None: uid = request.uid - is_admin = request.registry['res.users'].has_group(request.cr, uid, 'base.group_erp_manager') + is_admin = request.registry['res.users']._is_admin(request.cr, uid, [uid]) if not is_admin: raise openerp.exceptions.AccessError("Only administrators can upload a module") |
