fix: escape %% in SQL
This commit is contained in:
parent
262280a9ed
commit
99cb2ad8f8
@ -3,12 +3,11 @@
|
|||||||
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(
|
recs = await sor.sqlExe(
|
||||||
"SELECT path, roleid FROM rolepermission WHERE path LIKE '%login%'", {})
|
"SELECT path, roleid FROM rolepermission WHERE path LIKE '%%login%%'", {})
|
||||||
perms = [{"path": getattr(r, "path", ""), "roleid": getattr(r, "roleid", "")} for r in (recs or [])]
|
perms = [{"path": getattr(r, "path", ""), "roleid": getattr(r, "roleid", "")} for r in (recs or [])]
|
||||||
|
|
||||||
# Also check up_login
|
|
||||||
recs2 = await sor.sqlExe(
|
recs2 = await sor.sqlExe(
|
||||||
"SELECT path, roleid FROM rolepermission WHERE path LIKE '%up_login%' OR path LIKE '%login.ui%'", {})
|
"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 [])]
|
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)
|
return json.dumps({"login_perms": perms, "up_login_perms": perms2}, ensure_ascii=False)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user