From fe7192ecf1658be4d35a0482c2a42547c5072d63 Mon Sep 17 00:00:00 2001
From: Vincent Pelletier <vincent@nexedi.com>
Date: Fri, 3 Aug 2007 08:04:39 +0000
Subject: [PATCH] Replace new method getSecurityUidList by
 getSecurityUidListAndRoleColumnDict, because roles_column_dict must be
 handled along with security uids. Update partially WorkflowTool patch.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@15433 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5Catalog/CatalogTool.py       | 8 +++++---
 product/ERP5Type/patches/WorkflowTool.py | 8 +++++---
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/product/ERP5Catalog/CatalogTool.py b/product/ERP5Catalog/CatalogTool.py
index 59c53d26e1..3a00cf328a 100644
--- a/product/ERP5Catalog/CatalogTool.py
+++ b/product/ERP5Catalog/CatalogTool.py
@@ -460,9 +460,11 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject):
 
       return allowedRolesAndUsers, role_column_dict
 
-    def getSecurityUidList(self, **kw):
+    def getSecurityUidListAndRoleColumnDict(self, **kw):
       """
-        Return a list of security Uids.
+        Return a list of security Uids and a dictionnary containing available
+        role columns.
+        
         TODO: Add a cache.
       """
       allowedRolesAndUsers, role_column_dict = self.getAllowedRolesAndUsers(**kw)
@@ -470,7 +472,7 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject):
       method = getattr(catalog, catalog.sql_search_security)
       allowedRolesAndUsers = ["'%s'" % (role, ) for role in allowedRolesAndUsers]
       security_uid_list = [x.uid for x in method(security_roles_list = allowedRolesAndUsers)]
-      return security_uid_list
+      return security_uid_list, role_column_dict
 
     security.declarePublic( 'getSecurityQuery' )
     def getSecurityQuery(self, query=None, **kw):
diff --git a/product/ERP5Type/patches/WorkflowTool.py b/product/ERP5Type/patches/WorkflowTool.py
index e6a1909873..b64bb91a91 100644
--- a/product/ERP5Type/patches/WorkflowTool.py
+++ b/product/ERP5Type/patches/WorkflowTool.py
@@ -113,7 +113,7 @@ SECURITY_COLUMN_ID = 'security_uid'
 COUNT_COLUMN_TITLE = 'count'
 INTERNAL_CRITERION_KEY_LIST = (WORKLIST_METADATA_KEY, SECURITY_PARAMETER_ID)
 
-def groupWorklistListByCondition(worklist_dict, acceptable_key_dict, getSecurityUidList):
+def groupWorklistListByCondition(worklist_dict, acceptable_key_dict, getSecurityUidListAndRoleColumnDict):
   """
     Get a list of dict of WorklistVariableMatchDict grouped by compatible conditions.
     Strip any variable which is not a catalog column.
@@ -158,8 +158,10 @@ def groupWorklistListByCondition(worklist_dict, acceptable_key_dict, getSecurity
           if security_cache_key in security_cache:
             criterion_value = security_cache[security_cache_key]
           else:
-            security_query = getSecurityUidList(**{criterion_id: criterion_value})
-            criterion_value = security_query
+            security_uid_list, role_column_dict = getSecurityUidListAndRoleColumnDict(**{criterion_id: criterion_value})
+            # XXX: role_column_dict is ignored for now. This must be
+            # implemented.
+            criterion_value = security_uid_list
             security_cache[security_cache_key] = criterion_value
           criterion_id = SECURITY_COLUMN_ID
         else:
-- 
2.30.9