diff options
| author | Olivier Dony <odo@openerp.com> | 2013-08-20 18:52:58 +0200 |
|---|---|---|
| committer | Olivier Dony <odo@openerp.com> | 2013-08-20 18:52:58 +0200 |
| commit | c02afb45fa74fb1490b4b4965f987906ee718eb6 (patch) | |
| tree | 3e5836d53ddf07ee24acac430800becf25112fd7 /addons/document/document.py | |
| parent | b874f4bec27aa607f6958d7085d47fe44de5c748 (diff) | |
| parent | 788eb2923774555273ea3d440de8965998d663b6 (diff) | |
[MERGE] Forward-port of bugfixes from saas-1 series up to rev.8759 rev-id: odo@openerp.com-20130820152607-0p0fx87v1rqhk3vy
bzr revid: odo@openerp.com-20130820165258-3mjzbo990xg44dfu
Diffstat (limited to 'addons/document/document.py')
| -rw-r--r-- | addons/document/document.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/addons/document/document.py b/addons/document/document.py index 54f12e204fe..91af97246b8 100644 --- a/addons/document/document.py +++ b/addons/document/document.py @@ -68,11 +68,14 @@ class document_file(osv.osv): ] def check(self, cr, uid, ids, mode, context=None, values=None): - """Check access wrt. res_model, relax the rule of ir.attachment parent - With 'document' installed, everybody will have access to attachments of - any resources they can *read*. - """ - return super(document_file, self).check(cr, uid, ids, mode='read', context=context, values=values) + """Overwrite check to verify access on directory to validate specifications of doc/access_permissions.rst""" + super(document_file, self).check(cr, uid, ids, mode, context=context, values=values) + if ids: + self.pool.get('ir.model.access').check(cr, uid, 'document.directory', mode) + + # use SQL to avoid recursive loop on read + cr.execute('SELECT DISTINCT parent_id from ir_attachment WHERE id in %s AND parent_id is not NULL', (tuple(ids),)) + self.pool.get('document.directory').check_access_rule(cr, uid, [parent_id for (parent_id,) in cr.fetchall()], mode, context=context) def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False): # Grab ids, bypassing 'count' |
