Compat zope-2.12 : résolution des problèmes avec les interfaces.
[GroupUserFolder.git] / PatchCatalogTool.py
1 """
2 $Id: PatchCatalogTool.py,v 1.3 2003/07/10 15:27:22 pjgrizel dead $
3 """
4
5 try:
6 from Products.CMFCore.CatalogTool import CatalogTool
7 except ImportError:
8 pass
9 else:
10 if not hasattr(CatalogTool, '_old_listAllowedRolesAndUsers'):
11 def _listAllowedRolesAndUsers(self, user):
12 result = self._old_listAllowedRolesAndUsers(user)
13 getGroups = getattr(user, 'getGroups', None)
14 if getGroups is not None:
15 for group in getGroups():
16 result.append('user:'+group)
17 return result
18
19 from zLOG import LOG, INFO
20 LOG('GroupUserFolder', INFO, 'Patching CatalogTool')
21
22 CatalogTool._old_listAllowedRolesAndUsers = CatalogTool._listAllowedRolesAndUsers
23 CatalogTool._listAllowedRolesAndUsers = _listAllowedRolesAndUsers