Make comments editable

This commit is contained in:
Guido A.J. Stevens
2014-05-15 17:50:32 +02:00
committed by Andrea Cecchi
parent 2b18d5a2e4
commit a82352a36c
20 changed files with 359 additions and 10 deletions
+10 -1
View File
@@ -48,6 +48,7 @@ from Products.CMFCore.CMFCatalogAware import WorkflowAware
from OFS.role import RoleManager
from AccessControl import ClassSecurityInfo
from AccessControl.SecurityManagement import getSecurityManager
from Products.CMFCore import permissions
@@ -121,6 +122,14 @@ class Comment(CatalogAware, WorkflowAware, DynamicType, Traversable,
self.creation_date = self.modification_date = datetime.utcnow()
self.mime_type = 'text/plain'
user = getSecurityManager().getUser()
if user and user.getId():
aclpath = [x for x in user.getPhysicalPath() if x]
self._owner = (aclpath, user.getId(),)
self.__ac_local_roles__ = {
user.getId(): ['Owner']
}
@property
def __name__(self):
return self.comment_id and unicode(self.comment_id) or None
@@ -199,7 +208,7 @@ class Comment(CatalogAware, WorkflowAware, DynamicType, Traversable,
def Creator(self):
"""The name of the person who wrote the comment.
"""
return self.creator
return self.creator or self.author_name
security.declareProtected(permissions.View, 'Type')