diff --git a/rbac/userperm.py b/rbac/userperm.py index 354e7cd..46fd228 100644 --- a/rbac/userperm.py +++ b/rbac/userperm.py @@ -329,10 +329,10 @@ where a.id = c.userid if userid is None: roles = ['any', 'anonymous'] - if self.rp_caches is None or not roles: + if not _cache_enabled('rbac') or self.rp_caches is None or not roles: env = ServerEnv() async with get_sor_context(env, 'rbac') as sor: - if self.rp_caches is None: + if not _cache_enabled('rbac') or self.rp_caches is None: await self.load_roleperms(sor) if not roles: roles = await self.get_userroles(sor, userid)