Commit 920be763 authored by Julien Muchembled's avatar Julien Muchembled

* Set security of new Types Tool.

* Patch listFilteredActionsFor to not include actions from object.

git-svn-id: https://svn.erp5.org/repos/public/erp5/sandbox/portal_types@29238 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 844b6e68
......@@ -39,6 +39,7 @@ from zLOG import LOG, INFO
from string import join
import os, traceback
import warnings
import transaction
MARKER = []
......@@ -1352,6 +1353,8 @@ class ERP5Generator(PortalGenerator):
addTool('ERP5 Memcached Tool', None)
if not p.hasObject('portal_types'):
addTool('ERP5 Types Tool', None)
transaction.get().beforeCommitHook(lambda:
p.portal_types.Base_setDefaultSecurity())
try:
addTool = p.manage_addProduct['ERP5Subversion'].manage_addTool
......
......@@ -39,6 +39,7 @@ from Products.ERP5Type.patches import States
from Products.ERP5Type.patches import FSZSQLMethod
from Products.ERP5Type.patches import ActionInformation
from Products.ERP5Type.patches import ActionProviderBase
from Products.ERP5Type.patches import ActionsTool
from Products.ERP5Type.patches import CookieCrumbler
from Products.ERP5Type.patches import i18n
from Products.ERP5Type.patches import Localizer
......
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
# Copyright (c) 2009 Nexedi SARL and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
from Products.CMFCore.ActionsTool import ActionsTool, IActionProvider
ActionsTool_listFilteredActionsFor = ActionsTool.listFilteredActionsFor
def listFilteredActionsFor(self, object=None):
""" List all actions available to the user.
"""
actions = []
# Include actions from specific tools.
for provider_name in self.listActionProviders():
provider = getattr(self, provider_name)
if IActionProvider.isImplementedBy(provider):
actions.extend( provider.listActionInfos(object=object) )
else:
# for Action Providers written for CMF versions before 1.5
actions.extend( self._listActionInfos(provider, object) )
# Reorganize the actions by category.
filtered_actions={'user':[],
'folder':[],
'object':[],
'global':[],
'workflow':[],
}
for action in actions:
filtered_actions.setdefault(action['category'], []).append(action)
return filtered_actions
ActionsTool.listFilteredActionsFor = listFilteredActionsFor
--- Products/CMFCore/ActionsTool.py
+++ Products/CMFCore/ActionsTool.py
@@ -159,7 +159,7 @@
actions.extend( self._listActionInfos(provider, object) )
# Include actions from object.
- if object is not None:
+ if 0: #object is not None:
base = aq_base(object)
if IActionProvider.isImplementedBy(base):
actions.extend( object.listActionInfos(object=object) )
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