Commit 880cd583 authored by Yoshinori Okuji's avatar Yoshinori Okuji

Use CMFCore.permissions instead of CMFCore.CMFCorePermissions, if possible.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3988 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 8375e099
...@@ -28,10 +28,14 @@ ...@@ -28,10 +28,14 @@
import ExtensionClass import ExtensionClass
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.CMFCore import CMFCorePermissions
from Acquisition import aq_base from Acquisition import aq_base
from ZODB.POSException import ConflictError from ZODB.POSException import ConflictError
try:
from Products.CMFCore import permissions
except ImportError:
from Products.CMFCore import CMFCorePermissions as permissions
from zLOG import LOG from zLOG import LOG
DEFAULT_ACTIVITY = 'SQLDict' DEFAULT_ACTIVITY = 'SQLDict'
...@@ -82,7 +86,7 @@ class ActiveObject(ExtensionClass.Base): ...@@ -82,7 +86,7 @@ class ActiveObject(ExtensionClass.Base):
if passive_commit: get_transaction().commit() if passive_commit: get_transaction().commit()
return self return self
security.declareProtected( CMFCorePermissions.ModifyPortalContent, 'flushActivity' ) security.declareProtected( permissions.ModifyPortalContent, 'flushActivity' )
def flushActivity(self, invoke=0, **kw): def flushActivity(self, invoke=0, **kw):
activity_tool = getattr(self, 'portal_activities', None) activity_tool = getattr(self, 'portal_activities', None)
if activity_tool is None: return # Do nothing if no portal_activities if activity_tool is None: return # Do nothing if no portal_activities
...@@ -95,7 +99,7 @@ class ActiveObject(ExtensionClass.Base): ...@@ -95,7 +99,7 @@ class ActiveObject(ExtensionClass.Base):
# # nothing to do # # nothing to do
# pass # pass
security.declareProtected( CMFCorePermissions.ModifyPortalContent, 'recursiveFlushActivity' ) security.declareProtected( permissions.ModifyPortalContent, 'recursiveFlushActivity' )
def recursiveFlushActivity(self, invoke=0, **kw): def recursiveFlushActivity(self, invoke=0, **kw):
# flush all activities related to this object # flush all activities related to this object
self.flushActivity(invoke=invoke, **kw) self.flushActivity(invoke=invoke, **kw)
...@@ -104,7 +108,7 @@ class ActiveObject(ExtensionClass.Base): ...@@ -104,7 +108,7 @@ class ActiveObject(ExtensionClass.Base):
if hasattr(aq_base(self), 'recursiveFlushActivity'): if hasattr(aq_base(self), 'recursiveFlushActivity'):
o.recursiveFlushActivity(invoke=invoke, **kw) o.recursiveFlushActivity(invoke=invoke, **kw)
security.declareProtected( CMFCorePermissions.View, 'hasActivity' ) security.declareProtected( permissions.View, 'hasActivity' )
def hasActivity(self, **kw): def hasActivity(self, **kw):
""" """
Tells if an object if active Tells if an object if active
...@@ -120,21 +124,21 @@ class ActiveObject(ExtensionClass.Base): ...@@ -120,21 +124,21 @@ class ActiveObject(ExtensionClass.Base):
# there can not be any activity # there can not be any activity
return 0 return 0
security.declareProtected( CMFCorePermissions.View, 'hasErrorActivity' ) security.declareProtected( permissions.View, 'hasErrorActivity' )
def hasErrorActivity(self, **kw): def hasErrorActivity(self, **kw):
""" """
Tells if an object if active Tells if an object if active
""" """
return self.hasActivity(processing_node = INVOKE_ERROR_STATE) return self.hasActivity(processing_node = INVOKE_ERROR_STATE)
security.declareProtected( CMFCorePermissions.View, 'hasInvalidActivity' ) security.declareProtected( permissions.View, 'hasInvalidActivity' )
def hasInvalidActivity(self, **kw): def hasInvalidActivity(self, **kw):
""" """
Tells if an object if active Tells if an object if active
""" """
return self.hasActivity(processing_node = VALIDATE_ERROR_STATE) return self.hasActivity(processing_node = VALIDATE_ERROR_STATE)
security.declareProtected( CMFCorePermissions.View, 'getActiveProcess' ) security.declareProtected( permissions.View, 'getActiveProcess' )
def getActiveProcess(self): def getActiveProcess(self):
activity_tool = getattr(self, 'portal_activities', None) activity_tool = getattr(self, 'portal_activities', None)
if activity_tool is None: return None # Do nothing if no portal_activities if activity_tool is None: return None # Do nothing if no portal_activities
......
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