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 ): ...@@ -95,8 +95,3 @@ class Preference( Folder ):
def disable(self, **kw): def disable(self, **kw):
"""Workflow method""" """Workflow method"""
self._clearCache() 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, ...@@ -2688,15 +2688,15 @@ class Base( CopyContainer,
'isDeletable') 'isDeletable')
def isDeletable(self, check_relation): def isDeletable(self, check_relation):
"""Test if object can be delete""" """Test if object can be delete"""
portal = self.getPortalObject() container = self.getParentValue()
if not portal.portal_workflow.isTransitionPossible(self, 'delete'): portal = container.getPortalObject()
if not portal.portal_membership.checkPermission( return (portal.portal_workflow.isTransitionPossible(self, 'delete')
'Delete objects', self.getParentValue()): if container.portal_type != 'Preference' and
return False any(wf_id != 'edit_workflow'
for wf_id in getattr(aq_base(self), "workflow_history", ()): for wf_id in getattr(aq_base(self), "workflow_history", ()))
if wf_id != 'edit_workflow': else portal.portal_membership.checkPermission(
return False 'Delete objects', container)
return not (check_relation and self.getRelationCountForDeletion()) ) and not (check_relation and self.getRelationCountForDeletion())
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'isDeleted') '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