[Erp5-report] r13019 - /erp5/trunk/products/ERP5Security/ERP5GroupManager.py

nobody at svn.erp5.org nobody at svn.erp5.org
Sat Feb 24 20:01:49 CET 2007


Author: jp
Date: Sat Feb 24 20:01:39 2007
New Revision: 13019

URL: http://svn.erp5.org?rev=13019&view=rev
Log:
Added comments and switch for cache. Useful hints for debugging complex security issues which involve infinite recursion.

Modified:
    erp5/trunk/products/ERP5Security/ERP5GroupManager.py

Modified: erp5/trunk/products/ERP5Security/ERP5GroupManager.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Security/ERP5GroupManager.py?rev=13019&r1=13018&r2=13019&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Security/ERP5GroupManager.py (original)
+++ erp5/trunk/products/ERP5Security/ERP5GroupManager.py Sat Feb 24 20:01:39 2007
@@ -32,6 +32,14 @@
 from zLOG import LOG, WARNING
 
 from ERP5UserManager import SUPER_USER
+
+# It can be useful to set NO_CACHE_MODE to 1 in order to debug
+# complex security issues related to caching groups. For example,
+# the use of scripts instead of external methods for
+# assignment category lookup may make the system unstable and
+# hard to debug. Setting NO_CACHE_MODE allows to debug such
+# issues.
+NO_CACHE_MODE = 0
 
 class ConsistencyError(Exception): pass
 
@@ -170,8 +178,10 @@
         setSecurityManager(sm)
       return tuple(security_group_list)
 
-    _getGroupsForPrincipal = CachingMethod(_getGroupsForPrincipal,
-                                  id='ERP5GroupManager_getGroupsForPrincipal')
+    if not NO_CACHE_MODE:
+      _getGroupsForPrincipal = CachingMethod(_getGroupsForPrincipal,
+                                    id='ERP5GroupManager_getGroupsForPrincipal')
+
     return _getGroupsForPrincipal(
                 user_name=principal.getId(),
                 path=self.getPhysicalPath())




More information about the Erp5-report mailing list