forum and core: add access rights on search query

This commit is contained in:
2018-12-06 14:22:55 +01:00
committed by Skia
parent 525b047b4f
commit 3fdb83c1c2
3 changed files with 24 additions and 9 deletions

View File

@ -331,9 +331,9 @@ class ForumMessage(models.Model):
return user.can_edit(self.topic.forum)
def can_be_viewed_by(self, user):
return (
not self._deleted
) # No need to check the real rights since it's already done by the Topic view
return not self._deleted and self.topic.can_be_viewed_by(
user
) # Useful in search engine
def can_be_moderated_by(self, user):
return self.topic.forum.is_owned_by(user) or user.id == self.author.id