pipeline-sdlc/wwwroot/api/check_perm.dspy
2026-08-12 12:07:31 +08:00

17 lines
555 B
Plaintext

# check_perm.dspy
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
return json.dumps({"columns": cols, "total_perms": tc}, ensure_ascii=False)