This commit is contained in:
Gil Forcada 2015-05-03 08:41:24 +02:00
parent fad5a96129
commit 8b883451ca

View File

@ -118,15 +118,18 @@ class DeleteComment(BrowserView):
class DeleteOwnComment(DeleteComment): class DeleteOwnComment(DeleteComment):
"""Delete an own comment if it has no replies. Following conditions have to be true """Delete an own comment if it has no replies.
for a user to be able to delete his comments:
Following conditions have to be true for a user to be able to delete his
comments:
* "Delete own comments" permission * "Delete own comments" permission
* no replies to the comment * no replies to the comment
* Owner role directly assigned on the comment object * Owner role directly assigned on the comment object
""" """
def could_delete(self, comment=None): def could_delete(self, comment=None):
"""Returns true if the comment could be deleted if it had no replies.""" """Returns true if the comment could be deleted if it had no replies.
"""
sm = getSecurityManager() sm = getSecurityManager()
comment = comment or aq_inner(self.context) comment = comment or aq_inner(self.context)
userid = sm.getUser().getId() userid = sm.getUser().getId()