fix: check rolepermission columns
This commit is contained in:
parent
99cb2ad8f8
commit
a4e7d88993
@ -2,12 +2,15 @@
|
|||||||
|
|
||||||
dbname = get_module_dbname('rbac')
|
dbname = get_module_dbname('rbac')
|
||||||
async with DBPools().sqlorContext(dbname) as sor:
|
async with DBPools().sqlorContext(dbname) as sor:
|
||||||
recs = await sor.sqlExe(
|
# Check all perms
|
||||||
"SELECT path, roleid FROM rolepermission WHERE path LIKE '%%login%%'", {})
|
recs = await sor.sqlExe("SELECT * FROM rolepermission LIMIT 5", {})
|
||||||
perms = [{"path": getattr(r, "path", ""), "roleid": getattr(r, "roleid", "")} for r in (recs or [])]
|
if recs:
|
||||||
|
cols = [k for k in dir(recs[0]) if not k.startswith('_')]
|
||||||
|
else:
|
||||||
|
cols = []
|
||||||
|
|
||||||
recs2 = await sor.sqlExe(
|
# Check for login path in all perms
|
||||||
"SELECT path, roleid FROM rolepermission WHERE path LIKE '%%up_login%%' OR path LIKE '%%login.ui%%'", {})
|
count = await sor.sqlExe("SELECT COUNT(*) as c FROM rolepermission", {})
|
||||||
perms2 = [{"path": getattr(r, "path", ""), "roleid": getattr(r, "roleid", "")} for r in (recs2 or [])]
|
tc = getattr(count[0], "c", 0) if count else 0
|
||||||
|
|
||||||
return json.dumps({"login_perms": perms, "up_login_perms": perms2}, ensure_ascii=False)
|
return json.dumps({"columns": cols, "total_perms": tc}, ensure_ascii=False)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user