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

14 lines
666 B
Plaintext

# check_perm.dspy
dbname = get_module_dbname('rbac')
async with DBPools().sqlorContext(dbname) as sor:
recs = await sor.sqlExe(
"SELECT path, roleid FROM rolepermission WHERE path LIKE '%%login%%'", {})
perms = [{"path": getattr(r, "path", ""), "roleid": getattr(r, "roleid", "")} for r in (recs or [])]
recs2 = await sor.sqlExe(
"SELECT path, roleid FROM rolepermission WHERE path LIKE '%%up_login%%' OR path LIKE '%%login.ui%%'", {})
perms2 = [{"path": getattr(r, "path", ""), "roleid": getattr(r, "roleid", "")} for r in (recs2 or [])]
return json.dumps({"login_perms": perms, "up_login_perms": perms2}, ensure_ascii=False)