summaryrefslogtreecommitdiff
path: root/addons/mail/models/mail_thread.py
diff options
context:
space:
mode:
authorAnh Thao Pham (pta) <pta@odoo.com>2021-02-11 09:40:00 +0000
committerAnh Thao Pham (pta) <pta@odoo.com>2021-03-29 14:31:23 +0000
commit20536e1bbeb641539c0de44364f8376e7cef651b (patch)
tree59f731c45a7bfcad2fd712317515f43c22c556c0 /addons/mail/models/mail_thread.py
parent43bf5a5f048115a94eecc7a23a7e3fea119ac76c (diff)
[FIX] mail: prevent use of private addresses for followers, recipients,...
- Connect with Admin - Go to Contacts, edit himself by adding a Private Address - Create an Internal User without "Access to Private Addresses" right (i.e. User X) - Go to any app implementing chatter (i.e. Sales) - Create a SO - Add the created Private Address as follower - Make sure User X can access the record (i.e. Sales: Administrator) - Connect with User X and open the SO An Access Error is raised while trying to fetch data about the followers. This commit prevents to: - add a private address as follower of a record - add a private address as Recipient in full composer - propose private addresses when adding a mention to a partner opw-2428936 closes odoo/odoo#65933 Task-id: 2463622 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Diffstat (limited to 'addons/mail/models/mail_thread.py')
-rw-r--r--addons/mail/models/mail_thread.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/addons/mail/models/mail_thread.py b/addons/mail/models/mail_thread.py
index 8c27eed7703..4c85ef53044 100644
--- a/addons/mail/models/mail_thread.py
+++ b/addons/mail/models/mail_thread.py
@@ -2666,9 +2666,9 @@ class MailThread(models.AbstractModel):
self.check_access_rights('write')
self.check_access_rule('write')
- # filter inactive
+ # filter inactive and private addresses
if partner_ids and not adding_current:
- partner_ids = self.env['res.partner'].sudo().search([('id', 'in', partner_ids), ('active', '=', True)]).ids
+ partner_ids = self.env['res.partner'].sudo().search([('id', 'in', partner_ids), ('active', '=', True), ('type', '!=', 'private')]).ids
return self._message_subscribe(partner_ids, channel_ids, subtype_ids, customer_ids=customer_ids)