add delete_own_comment_enabled option in control panel

This commit is contained in:
Vincent Fretin
2014-09-20 16:02:48 +02:00
parent ee28528f55
commit 2a8082cfa7
9 changed files with 42 additions and 16 deletions
+8 -2
View File
@@ -346,8 +346,8 @@ class CommentsViewlet(ViewletBase):
aq_inner(reply))
def can_delete(self, reply):
"""By default requires 'Review comments'.
If 'delete own comments' is enabled, requires 'Edit comments'.
"""Returns true if current user has the 'Delete comments'
permission.
"""
return getSecurityManager().checkPermission('Delete comments',
aq_inner(reply))
@@ -482,6 +482,12 @@ class CommentsViewlet(ViewletBase):
settings = registry.forInterface(IDiscussionSettings, check=False)
return settings.edit_comment_enabled
def delete_own_comment_allowed(self):
# Check if delete own comments is allowed in the registry
registry = queryUtility(IRegistry)
settings = registry.forInterface(IDiscussionSettings, check=False)
return settings.delete_own_comment_enabled
def show_commenter_image(self):
# Check if showing commenter image is enabled in the registry
registry = queryUtility(IRegistry)