[Erp5-report] r25664 - /erp5/trunk/products/ERP5Wizard/Tool/IntrospectionTool.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Mon Feb 23 16:01:59 CET 2009
Author: ivan
Date: Mon Feb 23 16:01:58 2009
New Revision: 25664
URL: http://svn.erp5.org?rev=25664&view=rev
Log:
Implement menu handling.
Modified:
erp5/trunk/products/ERP5Wizard/Tool/IntrospectionTool.py
Modified: erp5/trunk/products/ERP5Wizard/Tool/IntrospectionTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Wizard/Tool/IntrospectionTool.py?rev=25664&r1=25663&r2=25664&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Wizard/Tool/IntrospectionTool.py [utf8] (original)
+++ erp5/trunk/products/ERP5Wizard/Tool/IntrospectionTool.py [utf8] Mon Feb 23 16:01:58 2009
@@ -30,17 +30,18 @@
from Globals import InitializeClass, DTMLFile
from Products.ERP5Type.Tool.BaseTool import BaseTool
from Products.ERP5Type import Permissions
+from AccessControl.SecurityManagement import setSecurityManager
from Products.ERP5Wizard import _dtmldir
from Products.ERP5Wizard.LogMixIn import LogMixIn
-from AccessControl.SecurityManagement import newSecurityManager, \
- getSecurityManager, setSecurityManager
-import zLOG
+from Products.ERP5Wizard.Tool.WizardTool import _setSuperSecurityManager
from Products.ERP5Type.Cache import CachingMethod
+
class IntrospectionTool(BaseTool, LogMixIn):
"""
- This tool provides both local and remote introspection.
+ This tool provides both local and remote introspection.
"""
+
id = 'portal_introspections'
title = 'Introspection Tool'
meta_type = 'ERP5 Introspection Tool'
@@ -52,4 +53,28 @@
security.declareProtected(Permissions.ManagePortal, 'manage_overview')
manage_overview = DTMLFile('explainIntrospectionTool', _dtmldir )
+ security.declareProtected('getERP5MenuItemList', Permissions.View)
+ def getERP5MenuItemList(self, kw):
+ """
+ Returns menu items for a given user
+ """
+ portal = self.getPortalObject()
+ user_name = kw.pop('user_name', None)
+ is_portal_manager = portal.portal_membership.checkPermission(Permissions.ManagePortal, \
+ portal)
+ downgrade_authenticated_user = user_name is not None and is_portal_manager
+ if downgrade_authenticated_user:
+ # downgrade to desired user
+ original_security_manager = _setSuperSecurityManager(self, user_name)
+
+ # call the method implementing it
+ erp5_menu_item_list = self._getTypeBasedMethod('getERP5MenuItemList',
+ fallback_script_id='ERP5Site_getERP5MenuItemList')()
+
+ if downgrade_authenticated_user:
+ # restore original Security Manager
+ setSecurityManager(original_security_manager)
+
+ return erp5_menu_item_list
+
InitializeClass(IntrospectionTool)
More information about the Erp5-report
mailing list