From c593c0cfe841793692ed82e0cf9b0f3f1ff3d96a Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Fri, 5 Apr 2013 16:16:18 +0200 Subject: [PATCH] [FIX] do not show suggestions for anonymous bzr revid: mat@openerp.com-20130405141618-zosargns9o355v7y --- addons/mail/mail_message.py | 1 - addons/mail/mail_thread.py | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/addons/mail/mail_message.py b/addons/mail/mail_message.py index 0af4f6d26ce..f0527a0cbd7 100644 --- a/addons/mail/mail_message.py +++ b/addons/mail/mail_message.py @@ -729,7 +729,6 @@ class mail_message(osv.Model): def check_related_document(self, cr, uid, model_obj, mids, operation, context=None): """Concrete check permission rules for related document""" - print(operation, mids, model_obj) 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) diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index 096481b1c55..61c198014f6 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -1254,6 +1254,21 @@ class mail_thread(osv.AbstractModel): """Return a list of suggested threads, sorted by the numbers of followers""" if context is None: context = {} + + # TOFIX : In case of user belonging to anonymous, do not show + # suggestions (doesn't make any sense). This should be done in + # portal_anonymous module. However done here because of static copy + # when using '_inherit'. Changes made in portal_anonymous wouldn't + # affect modules like mail_group. To move once the '_inherit' problem + # is solved + try: + anonymous_group = self.pool.get('ir.model.data').get_object(cr, SUPERUSER_ID, 'portal', 'group_anonymous') + if uid in [user.id for user in anonymous_group.users]: + return [] + except ValueError: + _logger.debug("Group portal.group_anonymous not existing, normal behavior") + + threads = [] if removed_suggested_threads is None: removed_suggested_threads = []