summaryrefslogtreecommitdiff
path: root/addons/im_livechat/controllers
diff options
context:
space:
mode:
authorThibault Delavallée <tde@odoo.com>2019-10-24 09:05:16 +0000
committerThibault Delavallée <tde@odoo.com>2019-11-29 13:35:14 +0000
commit69ccabb212d83bfee60c7dade36ca4b06f9f2f12 (patch)
tree18049ec2a94b7da7d0890bae10c8d35c2d01d427 /addons/im_livechat/controllers
parent1838191eece59051805862ed6ce914bf5e5d1efb (diff)
[FIX] mail: restrict access to mail.mail model
From now on mail.mail is considered as a technical model. Indeed people should not really manually craft mails by hand. Instead various functional flows should either send mails, either craft mails based on some user input. We therefore make mail restricted to admin users. Flows creating mail.mail are updated to use sudo, and ensure it was done in a context that makes sense to delegate this power to the user. Task ID 1853147 PR #32243
Diffstat (limited to 'addons/im_livechat/controllers')
-rw-r--r--addons/im_livechat/controllers/main.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/addons/im_livechat/controllers/main.py b/addons/im_livechat/controllers/main.py
index a4b5c7f8f9d..84f8a83ac47 100644
--- a/addons/im_livechat/controllers/main.py
+++ b/addons/im_livechat/controllers/main.py
@@ -152,6 +152,8 @@ class LivechatController(http.Controller):
@http.route('/im_livechat/email_livechat_transcript', type='json', auth='public', cors="*")
def email_livechat_transcript(self, uuid, email):
- channel = request.env['mail.channel'].sudo().search([('uuid', '=', uuid)], limit=1)
+ channel = request.env['mail.channel'].sudo().search([
+ ('channel_type', '=', 'livechat'),
+ ('uuid', '=', uuid)], limit=1)
if channel:
channel._email_livechat_transcript(email)