summaryrefslogtreecommitdiff
path: root/addons/mail/controllers
diff options
context:
space:
mode:
authorThibault Delavallée <tde@odoo.com>2019-05-13 09:31:04 +0000
committerThibault Delavallée <tde@odoo.com>2019-05-13 15:18:40 +0000
commit70d44ed787a8edc9d7c40b223dd628a4755f9614 (patch)
tree290ee5636eb4227156ce4d7b87232c39446c25e7 /addons/mail/controllers
parent3f707ba000a51011b5bc3f049632e051b5b7ef41 (diff)
[REF] mail, various : make message_get_suggested_recipients from mail.thread private
Purpose: make some methods from mail.thread mixin private and update their naming if necessary. Some methods prepare data for business flows and deal with internal information. Public methods should either use of give some access to those methods. Computation itself should be keps internal. In this commit we put message_get_suggested_recipients as private. As it is used in discuss JS we define a controller that controls access to this method. It explicitly checks for related document access rule and rights before calling the private method. Some addons are updated accordingly to the method change. Related to task ID 1911679 Linked to PR #29483
Diffstat (limited to 'addons/mail/controllers')
-rw-r--r--addons/mail/controllers/main.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/addons/mail/controllers/main.py b/addons/mail/controllers/main.py
index f1a233b1e5c..40ef7f9fe62 100644
--- a/addons/mail/controllers/main.py
+++ b/addons/mail/controllers/main.py
@@ -289,3 +289,13 @@ class MailController(http.Controller):
except:
return []
return records._message_partner_info_from_emails(emails, link_mail=link_mail)
+
+ @http.route('/mail/get_suggested_recipients', type='json', auth='user')
+ def message_get_suggested_recipients(self, model, res_ids):
+ records = request.env[model].browse(res_ids)
+ try:
+ records.check_access_rule('read')
+ records.check_access_rights('read')
+ except:
+ return {}
+ return records._message_get_suggested_recipients()