bugfix
This commit is contained in:
parent
ce1d99e1bc
commit
7102c43a04
@ -46,19 +46,17 @@ where a.id = c.userid
|
|||||||
return path in paths
|
return path in paths
|
||||||
|
|
||||||
async def is_user_has_path_perm(self, userid, path):
|
async def is_user_has_path_perm(self, userid, path):
|
||||||
roles = None
|
roles = self.ur_caches.get(userid)
|
||||||
if self.ur_caches is None:
|
|
||||||
async with get_sor_context(env, 'rbac') as sor:
|
|
||||||
await self.load_roleperms(sor)
|
|
||||||
if userid:
|
|
||||||
roles = self.ur_caches.get(userid)
|
|
||||||
if not roles:
|
|
||||||
await self.get_userroles(sor, userid)
|
|
||||||
roles = self.ur_caches.get(userid)
|
|
||||||
|
|
||||||
if userid is None:
|
if userid is None:
|
||||||
roles = ['anonymous']
|
roles = ['anonymous']
|
||||||
|
|
||||||
|
if self.rp_caches is None or not roles:
|
||||||
|
async with get_sor_context(env, 'rbac') as sor:
|
||||||
|
await self.load_roleperms(sor)
|
||||||
|
if not roles:
|
||||||
|
await self.get_userroles(sor, userid)
|
||||||
|
roles = self.ur_caches.get(userid)
|
||||||
|
|
||||||
return self.check_roles_path(roles, path)
|
return self.check_roles_path(roles, path)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user