diff options
| author | Martin Trigaux <mat@odoo.com> | 2020-01-13 15:18:36 +0100 |
|---|---|---|
| committer | Martin Trigaux <mat@odoo.com> | 2020-02-04 17:53:48 +0100 |
| commit | 6d8688bb124df311648f65f6d43608ee22d5f63b (patch) | |
| tree | 8731019c78312c44bc55db3f37dd1c6f840f0e21 /odoo/modules/loading.py | |
| parent | ce7cc63b58994885ce1ac1391e2b135a81630b20 (diff) | |
[IMP] base: use ir.model.access on transient models
Before this commit models with the `_transient` flag were ignored in
ir.model.access verifications. Only an implicit ir.rule with the
domain (create_uid=user.id) was applied to avoid most side effects.
The problem is that, often, the security does not lie in side-effects
of abusing of somebody else's wizard record but in the fact that the
wizard methods blindly trust only the right users are creating these
records. Too often, too many sudo were used and creating wizard with
chosen values could lead to an abuse scenario.
Instead, explicitly require the developer to declare security rules
the same way as on any other model.
Diffstat (limited to 'odoo/modules/loading.py')
| -rw-r--r-- | odoo/modules/loading.py | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/odoo/modules/loading.py b/odoo/modules/loading.py index b5cde25115c..9b1efca7cc4 100644 --- a/odoo/modules/loading.py +++ b/odoo/modules/loading.py @@ -443,17 +443,10 @@ def load_modules(db, force_demo=False, status=None, update_module=False): env = api.Environment(cr, SUPERUSER_ID, {}) cr.execute("""select model,name from ir_model where id NOT IN (select distinct model_id from ir_model_access)""") for (model, name) in cr.fetchall(): - if model in registry and not registry[model]._abstract and not registry[model]._transient: + if model in registry and not registry[model]._abstract: _logger.warning('The model %s has no access rules, consider adding one. E.g. access_%s,access_%s,model_%s,base.group_user,1,0,0,0', model, model.replace('.', '_'), model.replace('.', '_'), model.replace('.', '_')) - # Temporary warning while we remove access rights on osv_memory objects, as they have - # been replaced by owner-only access rights - cr.execute("""select distinct mod.model, mod.name from ir_model_access acc, ir_model mod where acc.model_id = mod.id""") - for (model, name) in cr.fetchall(): - if model in registry and registry[model]._transient: - _logger.warning('The transient model %s (%s) should not have explicit access rules!', model, name) - cr.execute("SELECT model from ir_model") for (model,) in cr.fetchall(): if model in registry: |
