From 3887bb9be5226d887322307b97083696753520a8 Mon Sep 17 00:00:00 2001
From: Vincent Pelletier <vincent@nexedi.com>
Date: Thu, 30 Oct 2008 10:16:18 +0000
Subject: [PATCH] Add a getter for security uid cache.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@24410 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ZSQLCatalog/SQLCatalog.py | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/product/ZSQLCatalog/SQLCatalog.py b/product/ZSQLCatalog/SQLCatalog.py
index 5db4272ff3..72b6ad2f75 100644
--- a/product/ZSQLCatalog/SQLCatalog.py
+++ b/product/ZSQLCatalog/SQLCatalog.py
@@ -721,6 +721,17 @@ class Catalog(Folder,
     self.security_uid_dict[allowed_roles_and_users] = security_uid
     return (security_uid, allowed_roles_and_users)
 
+  def getRoleAndSecurityUidList(self):
+    """
+      Return a list of 2-tuples, suitable for direct use in a zsqlmethod.
+      Goal: make it possible to regenerate a table containing this data.
+    """
+    result = []
+    extend = result.extend
+    for role_list, security_uid in getattr(aq_base(self), 'security_uid_dict', {}).iteritems():
+      extend([(role, security_uid) for role in role_list])
+    return result
+
   def clear(self):
     """
     Clears the catalog by calling a list of methods
-- 
2.30.9