fix: rp_cache should reload from DB when cache is disabled

This commit is contained in:
yumoqing 2026-05-30 10:19:00 +08:00
parent 04e9b718db
commit c776c0b3b5

View File

@ -329,10 +329,10 @@ where a.id = c.userid
if userid is None: if userid is None:
roles = ['any', 'anonymous'] 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() env = ServerEnv()
async with get_sor_context(env, 'rbac') as sor: 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) await self.load_roleperms(sor)
if not roles: if not roles:
roles = await self.get_userroles(sor, userid) roles = await self.get_userroles(sor, userid)