fix: to_dict
This commit is contained in:
parent
a4e7d88993
commit
fa9e37af51
@ -2,15 +2,10 @@
|
||||
|
||||
dbname = get_module_dbname('rbac')
|
||||
async with DBPools().sqlorContext(dbname) as sor:
|
||||
# Check all perms
|
||||
recs = await sor.sqlExe("SELECT * FROM rolepermission LIMIT 5", {})
|
||||
if recs:
|
||||
cols = [k for k in dir(recs[0]) if not k.startswith('_')]
|
||||
else:
|
||||
cols = []
|
||||
|
||||
# Check for login path in all perms
|
||||
count = await sor.sqlExe("SELECT COUNT(*) as c FROM rolepermission", {})
|
||||
tc = getattr(count[0], "c", 0) if count else 0
|
||||
recs = await sor.sqlExe("SELECT * FROM rolepermission WHERE roleid='any' LIMIT 3", {})
|
||||
result = []
|
||||
for r in (recs or []):
|
||||
d = r.to_dict() if hasattr(r, 'to_dict') else {}
|
||||
result.append(d)
|
||||
|
||||
return json.dumps({"columns": cols, "total_perms": tc}, ensure_ascii=False)
|
||||
return json.dumps({"any_perms": result}, ensure_ascii=False, default=str)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user