From f46977dc2beee54ee84930f297404bf69d0e1336 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Mon, 20 Aug 2007 08:50:32 +0000
Subject: [PATCH] Use getSecurityManager().getUser() to get the user name,
 because REQUEST.AUTHENTICATED_USER is not defined in ZopeTestCase requests.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@15745 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../Base_filterDuplicateActions.xml                 | 13 +++++++------
 product/ERP5/bootstrap/erp5_xhtml_style/bt/revision |  2 +-
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Base_filterDuplicateActions.xml b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Base_filterDuplicateActions.xml
index 64878c0287..7144283adf 100644
--- a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Base_filterDuplicateActions.xml
+++ b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Base_filterDuplicateActions.xml
@@ -75,7 +75,8 @@ In case of duplicate, only the first action will be kept.\n
 `actions` is the mapping returned by ActionsTool.listFilteredActionsFor\n
 The script must be called on the context of the document.\n
 """\n
-\n
+from Products.ERP5Type.Cache import CachingMethod\n
+from AccessControl import getSecurityManager\n
 def filterDuplicateActions(actions):\n
   new_actions = dict()\n
 \n
@@ -102,13 +103,12 @@ def hasDuplicateActions(portal_type, user_name):\n
   return len_actions != len_filtered_actions\n
 \n
 \n
-from Products.ERP5Type.Cache import CachingMethod\n
 hasDuplicateActions = CachingMethod(\n
                           hasDuplicateActions,\n
                           id=\'Base_filterDuplicateActions.hasDuplicateActions\',\n
                           cache_factory=\'erp5_ui_long\')\n
 \n
-user_name = str(container.REQUEST.AUTHENTICATED_USER)\n
+user_name = str(getSecurityManager().getUser())\n
 if getattr(context, \'getPortalType\', None) is not None:\n
   if hasDuplicateActions(context.getPortalType(), user_name):\n
     return filterDuplicateActions(actions)\n
@@ -162,13 +162,14 @@ return actions\n
                         <value>
                           <tuple>
                             <string>actions</string>
-                            <string>filterDuplicateActions</string>
-                            <string>hasDuplicateActions</string>
                             <string>Products.ERP5Type.Cache</string>
                             <string>CachingMethod</string>
+                            <string>AccessControl</string>
+                            <string>getSecurityManager</string>
+                            <string>filterDuplicateActions</string>
+                            <string>hasDuplicateActions</string>
                             <string>str</string>
                             <string>_getattr_</string>
-                            <string>container</string>
                             <string>user_name</string>
                             <string>getattr</string>
                             <string>context</string>
diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision b/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision
index 511fa83dfa..be6652a2ab 100644
--- a/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision
+++ b/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision
@@ -1 +1 @@
-414
\ No newline at end of file
+415
\ No newline at end of file
-- 
2.30.9