[FIX] website_slides: allow portal users to udpate their review

Followup of 86c80d341846894c435b1c8f61ef946b06e72ec7 : currently portal users face an access issue
if they change attachments in their review. This commit fixes that by sudo-ing
access to the attachment as other access is already granted.

Task ID 2214795

closes odoo/odoo#50815

X-original-commit: 90152abef30e043d36f8a8aabfe18c46e807973f
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
Thibault Delavallée
2020-05-07 09:03:24 +00:00
parent d0a855985f
commit 513c6d18df
+2 -2
View File
@@ -29,7 +29,7 @@ class SlidesPortalChatter(PortalChatter):
'/mail/chatter_update',
], type='http', auth="user")
def mail_update_message(self, res_model, res_id, message, message_id, redirect=None, attachment_ids='', attachment_tokens='', **post):
# keep this mecanism intern to slide currently (saas 12.5) as it is
# keep this mechanism intern to slide currently (saas 12.5) as it is
# considered experimental
if res_model != 'slide.channel':
raise Forbidden()
@@ -57,7 +57,7 @@ class SlidesPortalChatter(PortalChatter):
message = request.env['mail.message'].search(domain, limit=1)
if not message:
raise NotFound()
message.write({
message.sudo().write({
'body': message_body,
'attachment_ids': [(4, aid) for aid in attachment_ids],
})