def cache(self, participation, permission, obj, value): cache = self.getCache(participation) if cache is None or not cache['enabled']: return cache['debug_level'] += 1 CachingSecurityPolicy.cache( self, participation, permission, obj, value) key = self.cachingKey(permission, obj) if (key is not None and key in cache['perm'] and key not in cache['debug_order']): extra_info = (obj, cache['debug_level']) cache['debug_order'].append((key, extra_info))
def getCache(cls, participation): cache = CachingSecurityPolicy.getCache(participation) if (cache is not None and 'debug_order' not in cache): cache['debug_order'] = [] cache['debug_level'] = 0 return cache
def checkPermission(self, permission, obj): caches = filter(None, [self.getCache(p) for p in self.participations]) levels = [cache['debug_level'] for cache in caches] perm = CachingSecurityPolicy.checkPermission( self, permission, obj) for cache, level in zip(caches, levels): cache['debug_level'] = level return perm