Commit d33fecd7 authored by Jean-Paul Smets's avatar Jean-Paul Smets

Added comments and switch for cache. Useful hints for debugging complex...

Added comments and switch for cache. Useful hints for debugging complex security issues which involve infinite recursion.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13019 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 1f766b45
...@@ -33,6 +33,14 @@ from zLOG import LOG, WARNING ...@@ -33,6 +33,14 @@ from zLOG import LOG, WARNING
from ERP5UserManager import SUPER_USER 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 class ConsistencyError(Exception): pass
manage_addERP5GroupManagerForm = PageTemplateFile( manage_addERP5GroupManagerForm = PageTemplateFile(
...@@ -170,8 +178,10 @@ class ERP5GroupManager(BasePlugin): ...@@ -170,8 +178,10 @@ class ERP5GroupManager(BasePlugin):
setSecurityManager(sm) setSecurityManager(sm)
return tuple(security_group_list) return tuple(security_group_list)
if not NO_CACHE_MODE:
_getGroupsForPrincipal = CachingMethod(_getGroupsForPrincipal, _getGroupsForPrincipal = CachingMethod(_getGroupsForPrincipal,
id='ERP5GroupManager_getGroupsForPrincipal') id='ERP5GroupManager_getGroupsForPrincipal')
return _getGroupsForPrincipal( return _getGroupsForPrincipal(
user_name=principal.getId(), user_name=principal.getId(),
path=self.getPhysicalPath()) path=self.getPhysicalPath())
......
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