[CMF-checkins] CVS: CMF/CMFCore - ActionsTool.py:1.16 CMFCorePermissions.py:1.8 UndoTool.py:1.3
Tres Seaver
tseaver@zope.com
Thu, 15 Nov 2001 18:17:09 -0500
Update of /cvs-repository/CMF/CMFCore
In directory cvs.zope.org:/tmp/cvs-serv18184/CMFCore
Modified Files:
ActionsTool.py CMFCorePermissions.py UndoTool.py
Log Message:
- Make UndoTool an ActionProvider.
- Protect query of undoable actions by its own permission, so that
Members can have it without also having 'Undo changes' for the
whole portal.
=== CMF/CMFCore/ActionsTool.py 1.15 => 1.16 ===
meta_type = 'CMF Actions Tool'
- action_providers = (
- 'portal_actions',
- 'portal_discussion',
- 'portal_membership',
- 'portal_workflow',
- )
+ action_providers = ( 'portal_actions'
+ , 'portal_discussion'
+ , 'portal_membership'
+ , 'portal_workflow'
+ , 'portal_undo'
+ )
security = ClassSecurityInfo()
@@ -217,7 +217,7 @@
actions = []
# Include actions from specific tools.
- for provider_name in self.action_providers:
+ for provider_name in self.listActionProviders():
provider = getattr(self, provider_name)
a = provider.listActions(info)
if a:
@@ -320,10 +320,6 @@
'url': portal_url + '/logout',
'permissions' : [],
'category': 'user'},
- {'name': 'Undo',
- 'url': 'undo_form',
- 'permissions': ['Undo changes'],
- 'category': 'global'},
{'name': 'Reconfigure portal',
'url': portal_url + '/reconfig_form',
'permissions': ['Manage portal'],
=== CMF/CMFCore/CMFCorePermissions.py 1.7 => 1.8 ===
setDefaultRoles( ListFolderContents, ( 'Manager', 'Owner' ) )
+ListUndoableChanges = 'List undoable changes'
+setDefaultRoles( ListUndoableChanges, ( 'Manager', 'Member' ) )
+
AccessInactivePortalContent = 'Access inactive portal content'
setDefaultRoles(AccessInactivePortalContent, ('Manager',))
=== CMF/CMFCore/UndoTool.py 1.2 => 1.3 ===
from AccessControl import ClassSecurityInfo
-from CMFCorePermissions import UndoChanges
-import CMFCorePermissions
+from CMFCorePermissions import ManagePortal, UndoChanges, ListUndoableChanges
class UndoTool (UniqueObject, SimpleItem):
id = 'portal_undo'
@@ -114,14 +113,25 @@
#
# ZMI methods
#
- security.declareProtected( CMFCorePermissions.ManagePortal
+ security.declareProtected( ManagePortal
, 'manage_overview' )
manage_overview = DTMLFile( 'explainUndoTool', _dtmldir )
+ security.declarePrivate('listActions')
+ def listActions( self, info ):
+ if info.isAnonymous:
+ return []
+ return [ { 'name': 'Undo'
+ , 'url': 'undo_form'
+ , 'permissions': [ ListUndoableChanges ]
+ , 'category': 'global'
+ } ]
+
#
# 'portal_undo' interface methods
#
- security.declareProtected(UndoChanges, 'listUndoableTransactionsFor')
+ security.declareProtected( ListUndoableChanges
+ , 'listUndoableTransactionsFor')
def listUndoableTransactionsFor(self, object,
first_transaction=None,
last_transaction=None,