Commit fd1a7c2b authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

manage_afterAdd, manage_afterClone and manage_beforeDelete should be private.

parent fe3a1740
...@@ -798,10 +798,12 @@ class ActivityTool (Folder, UniqueObject): ...@@ -798,10 +798,12 @@ class ActivityTool (Folder, UniqueObject):
url += urllib.quote('Cancel and invoke links visible') url += urllib.quote('Cancel and invoke links visible')
RESPONSE.redirect(url) RESPONSE.redirect(url)
security.declarePrivate('manage_beforeDelete')
def manage_beforeDelete(self, item, container): def manage_beforeDelete(self, item, container):
self.unsubscribe() self.unsubscribe()
Folder.inheritedAttribute('manage_beforeDelete')(self, item, container) Folder.inheritedAttribute('manage_beforeDelete')(self, item, container)
security.declarePrivate('manage_afterAdd')
def manage_afterAdd(self, item, container): def manage_afterAdd(self, item, container):
self.subscribe() self.subscribe()
Folder.inheritedAttribute('manage_afterAdd')(self, item, container) Folder.inheritedAttribute('manage_afterAdd')(self, item, container)
......
...@@ -66,6 +66,7 @@ class BaseCategory(CMFBaseCategory, XMLObject): ...@@ -66,6 +66,7 @@ class BaseCategory(CMFBaseCategory, XMLObject):
#result.extend(self.portal_catalog()) #result.extend(self.portal_catalog())
return result return result
security.declarePrivate('manage_afterAdd')
def manage_afterAdd(self, item, container): def manage_afterAdd(self, item, container):
""" """
Reset Accessors Reset Accessors
......
...@@ -55,6 +55,7 @@ class Bug(Ticket): ...@@ -55,6 +55,7 @@ class Bug(Ticket):
, PropertySheet.Bug , PropertySheet.Bug
) )
security.declarePrivate('manage_afterClone')
def manage_afterClone(self, item): def manage_afterClone(self, item):
Ticket.manage_afterClone(self, item) Ticket.manage_afterClone(self, item)
# delete existing bug lines # delete existing bug lines
......
...@@ -4789,7 +4789,7 @@ Business Template is a set of definitions, such as skins, portal types and categ ...@@ -4789,7 +4789,7 @@ Business Template is a set of definitions, such as skins, portal types and categ
XMLObject.__init__(self, *args, **kw) XMLObject.__init__(self, *args, **kw)
self._clean() self._clean()
security.declareProtected(Permissions.ManagePortal, 'manage_afterAdd') security.declarePrivate('manage_afterAdd')
def manage_afterAdd(self, item, container): def manage_afterAdd(self, item, container):
""" """
This is called when a new business template is added or imported. This is called when a new business template is added or imported.
......
...@@ -364,6 +364,7 @@ class ERP5Site(FolderMixIn, CMFSite, CacheCookieMixin): ...@@ -364,6 +364,7 @@ class ERP5Site(FolderMixIn, CMFSite, CacheCookieMixin):
return self return self
security.declarePrivate('manage_beforeDelete')
def manage_beforeDelete(self, item, container): def manage_beforeDelete(self, item, container):
# skin is setup during __before_publishing_traverse__, which # skin is setup during __before_publishing_traverse__, which
# doesn't happen when the object is being deleted from the management # doesn't happen when the object is being deleted from the management
......
...@@ -474,6 +474,7 @@ class RuleMixin(Predicate): ...@@ -474,6 +474,7 @@ class RuleMixin(Predicate):
class SimulableMixin(Base): class SimulableMixin(Base):
security = ClassSecurityInfo()
def updateSimulation(self, **kw): def updateSimulation(self, **kw):
"""Create/update related simulation trees by activity """Create/update related simulation trees by activity
...@@ -600,6 +601,7 @@ class SimulableMixin(Base): ...@@ -600,6 +601,7 @@ class SimulableMixin(Base):
return applied_rule return applied_rule
raise SimulationError("No such rule as %r is found" % rule_reference) raise SimulationError("No such rule as %r is found" % rule_reference)
security.declarePrivate('manage_beforeDelete')
def manage_beforeDelete(self, item, container): def manage_beforeDelete(self, item, container):
"""Delete related Applied Rule""" """Delete related Applied Rule"""
for o in self.getCausalityRelatedValueList(portal_type='Applied Rule'): for o in self.getCausalityRelatedValueList(portal_type='Applied Rule'):
......
...@@ -68,12 +68,12 @@ class TimerServiceMixin(object): ...@@ -68,12 +68,12 @@ class TimerServiceMixin(object):
return "Usubscribed from Timer Service" return "Usubscribed from Timer Service"
return "TimerService not available" return "TimerService not available"
security.declareProtected(Permissions.ManageProperties, 'manage_beforeDelete') security.declarePrivate('manage_beforeDelete')
def manage_beforeDelete(self, *args, **kw): def manage_beforeDelete(self, *args, **kw):
self.unsubscribe() self.unsubscribe()
super(TimerServiceMixin, self).manage_beforeDelete(*args, **kw) super(TimerServiceMixin, self).manage_beforeDelete(*args, **kw)
security.declareProtected(Permissions.ManageProperties, 'manage_afterAdd') security.declarePrivate('manage_afterAdd')
def manage_afterAdd(self, *args, **kw): def manage_afterAdd(self, *args, **kw):
self.unsubscribe() self.unsubscribe()
super(TimerServiceMixin, self).manage_afterAdd(*args, **kw) super(TimerServiceMixin, self).manage_afterAdd(*args, **kw)
......
...@@ -65,6 +65,7 @@ class BankingOperation(BaobabMixin, AccountingTransaction): ...@@ -65,6 +65,7 @@ class BankingOperation(BaobabMixin, AccountingTransaction):
, PropertySheet.Amount , PropertySheet.Amount
) )
security.declarePrivate('manage_beforeDelete')
def manage_beforeDelete(self, item, container): def manage_beforeDelete(self, item, container):
""" """
The right of deleting must be define by workflows The right of deleting must be define by workflows
......
...@@ -234,6 +234,7 @@ class CopyContainer: ...@@ -234,6 +234,7 @@ class CopyContainer:
return self.manage_main(self, REQUEST, update_menu=1) return self.manage_main(self, REQUEST, update_menu=1)
# Copy and paste support # Copy and paste support
security.declarePrivate('manage_afterClone')
def manage_afterClone(self, item): def manage_afterClone(self, item):
""" """
Add self to the workflow. Add self to the workflow.
...@@ -316,6 +317,7 @@ class CopyContainer: ...@@ -316,6 +317,7 @@ class CopyContainer:
script() script()
security.declarePrivate('manage_afterAdd')
def manage_afterAdd(self, item, container): def manage_afterAdd(self, item, container):
""" """
Add self to the catalog. Add self to the catalog.
...@@ -328,6 +330,7 @@ class CopyContainer: ...@@ -328,6 +330,7 @@ class CopyContainer:
if getattr(self, 'isIndexable', 1): if getattr(self, 'isIndexable', 1):
self.__recurse('manage_afterAdd', item, container) self.__recurse('manage_afterAdd', item, container)
security.declarePrivate('manage_beforeDelete')
def manage_beforeDelete(self, item, container): def manage_beforeDelete(self, item, container):
""" """
Remove self from the catalog. Remove self from the catalog.
......
...@@ -554,7 +554,7 @@ class ZMIField( ...@@ -554,7 +554,7 @@ class ZMIField(
getattr(self, method_name)(values[key]) getattr(self, method_name)(values[key])
security.declareProtected('Change Formulator Forms', 'manage_beforeDelete') security.declarePrivate('manage_beforeDelete')
def manage_beforeDelete(self, item, container): def manage_beforeDelete(self, item, container):
"""Remove name from list if object is deleted. """Remove name from list if object is deleted.
""" """
...@@ -562,7 +562,7 @@ class ZMIField( ...@@ -562,7 +562,7 @@ class ZMIField(
if hasattr(item.aq_explicit, 'is_field'): if hasattr(item.aq_explicit, 'is_field'):
container.field_removed(item.id) container.field_removed(item.id)
security.declareProtected('Change Formulator Forms', 'manage_afterAdd') security.declarePrivate('manage_afterAdd')
def manage_afterAdd(self, item, container): def manage_afterAdd(self, item, container):
"""What happens when we add a field. """What happens when we add a field.
""" """
......
...@@ -99,6 +99,7 @@ from App.ImageFile import ImageFile ...@@ -99,6 +99,7 @@ from App.ImageFile import ImageFile
from DateTime import DateTime from DateTime import DateTime
from . import DABase from . import DABase
from .db import DB, DeferredDB from .db import DB, DeferredDB
from AccessControl import ClassSecurityInfo
SHARED_DC_ZRDB_LOCATION = os.path.dirname(Shared.DC.ZRDB.__file__) SHARED_DC_ZRDB_LOCATION = os.path.dirname(Shared.DC.ZRDB.__file__)
...@@ -132,6 +133,7 @@ class Connection(DABase.Connection): ...@@ -132,6 +133,7 @@ class Connection(DABase.Connection):
id='%s_database_connection' % database_type id='%s_database_connection' % database_type
meta_type=title='Z %s Database Connection' % database_type meta_type=title='Z %s Database Connection' % database_type
icon='misc_/Z%sDA/conn' % database_type icon='misc_/Z%sDA/conn' % database_type
security = ClassSecurityInfo()
manage_properties=HTMLFile('connectionEdit', globals()) manage_properties=HTMLFile('connectionEdit', globals())
...@@ -139,6 +141,7 @@ class Connection(DABase.Connection): ...@@ -139,6 +141,7 @@ class Connection(DABase.Connection):
def factory(self): return DB def factory(self): return DB
security.declarePrivate('manage_beforeDelete')
def manage_beforeDelete(self, item, container): def manage_beforeDelete(self, item, container):
database_connection_pool.get(self._p_oid, {}).pop(self._p_jar, None) database_connection_pool.get(self._p_oid, {}).pop(self._p_jar, None)
......
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