[FIX] do not show suggestions for anonymous

bzr revid: mat@openerp.com-20130405141618-zosargns9o355v7y
This commit is contained in:
Martin Trigaux
2013-04-05 16:16:18 +02:00
parent 87e3fe92bd
commit c593c0cfe8
2 changed files with 15 additions and 1 deletions
-1
View File
@@ -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)
+15
View File
@@ -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 = []