diff options
| author | Thibault Delavallée <tde@openerp.com> | 2013-05-28 16:44:47 +0200 |
|---|---|---|
| committer | Thibault Delavallée <tde@openerp.com> | 2013-05-28 16:44:47 +0200 |
| commit | cdffc4db54e7f385bd2a283f91ae2e65b1268bd7 (patch) | |
| tree | 2e72f1020e6204b1eb6c3b5688ff06989b91c147 /addons/mail/mail_thread.py | |
| parent | 2d8f1f43276b6fe2d62bfe8666c771e34d096104 (diff) | |
[FIX] project_issue: fixed write of date_action_last: it is possible to post a message without having access to write access rights on an issue, therefore using SUPERUSER_ID (e.g. portal user).
[FIX] mail_message, mail, project, task, issue: it is now possible to have model-specific access rule checking for mail.message related acces right / rules. Task and issue allow to create mail.message when the user has a read access on the related document, not only when having write access.
bzr revid: tde@openerp.com-20130528144447-3ivcom6r9x7q949b
Diffstat (limited to 'addons/mail/mail_thread.py')
| -rw-r--r-- | addons/mail/mail_thread.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index 5edc2f436d5..0ca6a75db85 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -449,6 +449,20 @@ class mail_thread(osv.AbstractModel): ir_attachment_obj.unlink(cr, uid, attach_ids, context=context) return True + def check_mail_message_access(self, cr, uid, mids, operation, model_obj=None, context=None): + """ mail.message check permission rules for related document. This method is + meant to be inherited in order to implement addons-specific behavior. + A common behavior would be to allow creating messages when having read + access rule on the document, for portal document such as issues. """ + if not model_obj: + model_obj = self + if operation in ['create', 'write', 'unlink']: + model_obj.check_access_rights(cr, uid, 'write') + model_obj.check_access_rule(cr, uid, mids, 'write', context=context) + else: + model_obj.check_access_rights(cr, uid, operation) + model_obj.check_access_rule(cr, uid, mids, operation, context=context) + #------------------------------------------------------ # Email specific #------------------------------------------------------ |
