This commit is contained in:
yumoqing 2025-10-20 14:17:59 +08:00
parent 54c36d0014
commit 18668402cc

View File

@ -9,8 +9,8 @@ class CacheUP:
self.paths = paths self.paths = paths
self.sql_all = """select a.id,b.path from users a, userrole c, rolepermission d, permission b self.sql_all = """select a.id,b.path from users a, userrole c, rolepermission d, permission b
where a.id = c.userid where a.id = c.userid
and c.roleid = d.roleid and c.roleid = d.roleid
and d.permid = b.id""" and d.permid = b.id"""
def get_paths(self): def get_paths(self):
self.touch_time = time.time() self.touch_time = time.time()
@ -74,16 +74,16 @@ where a.id = c.userid
return cup.get_paths() return cup.get_paths()
async def refresh_all_cup(self): async def refresh_all_cup(self):
db = DBPools() db = DBPools()
env = ServerEnv() env = ServerEnv()
dbname = env.get_module_dbname('rbac') dbname = env.get_module_dbname('rbac')
sql = """select a.id,b.path from users a, userrole c, rolepermission d, permission b sql = """select a.id,b.path from users a, userrole c, rolepermission d, permission b
where a.id = c.userid where a.id = c.userid
and c.roleid = d.roleid and c.roleid = d.roleid
and d.permid = b.id order by a.id, b.path""" and d.permid = b.id order by a.id, b.path"""
async with db.sqlorContext(dbname) as sor: async with db.sqlorContext(dbname) as sor:
ups = await sor.sqlExe(sql, {'userid': userid}) ups = await sor.sqlExe(sql, {'userid': userid})
userid = '' userid = ''
paths = [] paths = []
for u in ups: for u in ups: