Commit a2122c35 authored by Xiaowu Zhang's avatar Xiaowu Zhang Committed by Julien Muchembled

Base: fix special case of Preference in isDeletable

parent 6234289c
......@@ -95,8 +95,3 @@ class Preference( Folder ):
def disable(self, **kw):
"""Workflow method"""
self._clearCache()
security.declareProtected(Permissions.AccessContentsInformation,
'isDeletable')
def isDeletable(self, check_relation):
return not (check_relation and self.getRelationCountForDeletion())
......@@ -2688,15 +2688,15 @@ class Base( CopyContainer,
'isDeletable')
def isDeletable(self, check_relation):
"""Test if object can be delete"""
portal = self.getPortalObject()
if not portal.portal_workflow.isTransitionPossible(self, 'delete'):
if not portal.portal_membership.checkPermission(
'Delete objects', self.getParentValue()):
return False
for wf_id in getattr(aq_base(self), "workflow_history", ()):
if wf_id != 'edit_workflow':
return False
return not (check_relation and self.getRelationCountForDeletion())
container = self.getParentValue()
portal = container.getPortalObject()
return (portal.portal_workflow.isTransitionPossible(self, 'delete')
if container.portal_type != 'Preference' and
any(wf_id != 'edit_workflow'
for wf_id in getattr(aq_base(self), "workflow_history", ()))
else portal.portal_membership.checkPermission(
'Delete objects', container)
) and not (check_relation and self.getRelationCountForDeletion())
security.declareProtected(Permissions.AccessContentsInformation,
'isDeleted')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment