added Delete comments permission to manage comments deletion

This commit is contained in:
Andrea Cecchi
2014-05-15 17:51:05 +02:00
parent fd16144b9b
commit 9a4e3718fc
10 changed files with 43 additions and 98 deletions
+1 -10
View File
@@ -328,18 +328,9 @@ class CommentsViewlet(ViewletBase):
"""By default requires 'Review comments'.
If 'delete own comments' is enabled, requires 'Edit comments'.
"""
if self.is_delete_own_comment_allowed():
permission = 'Edit comments'
else:
permission = 'Review comments'
return getSecurityManager().checkPermission(permission,
return getSecurityManager().checkPermission('Delete comments',
aq_inner(reply))
def is_delete_own_comment_allowed(self):
registry = queryUtility(IRegistry)
settings = registry.forInterface(IDiscussionSettings, check=False)
return settings.delete_own_comment_enabled
def is_discussion_allowed(self):
context = aq_inner(self.context)
return context.restrictedTraverse('@@conversation_view').enabled()