[CMF-checkins] CVS: CMF/CMFDefault - MembershipTool.py:1.17 RegistrationTool.py:1.7
Andrew Sawyers
andrew@zope.com
Tue, 4 Dec 2001 16:53:45 -0500
Update of /cvs-repository/CMF/CMFDefault
In directory cvs.zope.org:/tmp/cvs-serv18581/CMFDefault
Modified Files:
MembershipTool.py RegistrationTool.py
Log Message:
*tracker #288
*changed ActionsTool listActions to return None
*added listActions method to support moving the actions from
ActionsTool to their respective Tools
*added FTY ids and folder_contents as an action to PortalFolder
=== CMF/CMFDefault/MembershipTool.py 1.16 => 1.17 ===
from AccessControl import ClassSecurityInfo
from Products.CMFCore.CMFCorePermissions import View, AccessContentsInformation
-from Products.CMFCore.CMFCorePermissions import ListPortalMembers
+from Products.CMFCore.CMFCorePermissions import ListPortalMembers, AddPortalMember
from Products.CMFCore.CMFCorePermissions import ManagePortal
from utils import _dtmldir
@@ -154,13 +154,40 @@
def listActions(self, info):
'''Lists actions available to the user.'''
user_actions = None
+ portal_url = info.portal_url
+ if info.isAnonymous:
+ user_actions = (
+ {'name': 'Log in',
+ 'url': portal_url + '/login_form',
+ 'permissions': [],
+ 'category': 'user'},
+ {'name': 'Join',
+ 'url': portal_url + '/join_form',
+ 'permissions': [AddPortalMember],
+ 'category': 'user'},
+ )
if not info.isAnonymous:
home_folder = self.getHomeFolder()
homeUrl = self.getHomeUrl()
+ user_actions = (
+ {'name': 'Preferences',
+ 'url': portal_url + '/personalize_form',
+ 'permissions': [],
+ 'category': 'user'},
+ {'name': 'Log out',
+ 'url': portal_url + '/logout',
+ 'permissions' : [],
+ 'category': 'user'},
+ {'name': 'Reconfigure portal',
+ 'url': portal_url + '/reconfig_form',
+ 'permissions': ['Manage portal'],
+ 'category': 'global'},
+ )
+
if homeUrl is not None:
content_url = info.content_url
- user_actions = (
+ actions = (
{'name': 'Add to Favorites',
'url': ( content_url + '/addtoFavorites' ),
'permissions' : [],
@@ -170,6 +197,7 @@
'permissions': [],
'category': 'user'},
)
+ user_actions = user_actions + actions
if hasattr( home_folder, 'Favorites' ):
added_actions = (
@@ -177,9 +205,8 @@
'url' : homeUrl + '/Favorites/folder_contents',
'permissions': [],
'category': 'user'},)
+ user_actions = user_actions + added_actions
- user_actions = added_actions + user_actions
-
return user_actions
=== CMF/CMFDefault/RegistrationTool.py 1.6 => 1.7 ===
return None
+ security.declarePublic('listActions')
+ def listActions(self, info):
+ """
+ """
+
security.declarePublic( 'testPropertiesValidity' )
def testPropertiesValidity(self, props, member=None):
'''If the properties are valid, returns None. If not, returns