fix: remove status column
This commit is contained in:
parent
38a69defae
commit
41f0a585cd
@ -1,24 +1,13 @@
|
|||||||
# check_users.dspy - 检查用户表
|
# check_users.dspy
|
||||||
|
|
||||||
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("SELECT id, username, status FROM users LIMIT 10", {})
|
recs = await sor.sqlExe("SELECT id, username FROM users LIMIT 10", {})
|
||||||
users = []
|
users = [{"id": getattr(r, "id", ""), "username": getattr(r, "username", "")} for r in (recs or [])]
|
||||||
for r in (recs or []):
|
|
||||||
users.append({
|
|
||||||
"id": getattr(r, "id", ""),
|
|
||||||
"username": getattr(r, "username", ""),
|
|
||||||
"status": getattr(r, "status", ""),
|
|
||||||
})
|
|
||||||
|
|
||||||
admin = await sor.sqlExe("SELECT id, username, password, status FROM users WHERE username='admin'", {})
|
admin = await sor.sqlExe("SELECT id, username, password FROM users WHERE username='admin'", {})
|
||||||
admin_info = None
|
admin_info = None
|
||||||
for a in (admin or []):
|
for a in (admin or []):
|
||||||
admin_info = {
|
admin_info = {"id": getattr(a, "id", ""), "username": getattr(a, "username", ""), "password_hash": getattr(a, "password", "")[:40]}
|
||||||
"id": getattr(a, "id", ""),
|
|
||||||
"username": getattr(a, "username", ""),
|
|
||||||
"password_hash": getattr(a, "password", "")[:40],
|
|
||||||
"status": getattr(a, "status", ""),
|
|
||||||
}
|
|
||||||
|
|
||||||
return json.dumps({"users": users, "admin": admin_info}, ensure_ascii=False)
|
return json.dumps({"users": users, "admin": admin_info}, ensure_ascii=False)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user