def decorate_method(h, method): decorator_authentication = getattr(h, 'authentication') value = getattr(h, 'check_roles') if isinstance(value, str): value = {value} f = getattr(h, method) if method == 'get': if h.cache_resource: f = apicache.decorator_cache_get(f) else: if h.invalidate_cache: f = apicache.decorator_cache_invalidate(f) f = decorator_authentication(f, value) setattr(h, method, f)
def decorate_method(h, method): value = getattr(h, 'check_roles') if isinstance(value, str): value = {value} f = getattr(h, method) if State.settings.enable_api_cache: if method == 'get': if h.cache_resource: f = apicache.decorator_cache_get(f) else: if h.invalidate_global_cache or h.invalidate_cache: f = apicache.decorator_cache_invalidate(f) if h.invalidate_tenant_state: f = getattr(h, 'decorator_invalidate_tenant_state')(f) f = getattr(h, 'decorator_authentication')(f, value) setattr(h, method, f)