This commit is contained in:
yumoqing 2025-04-12 19:14:26 +08:00
parent c287e36ca0
commit 4521bcb143

View File

@ -46,7 +46,7 @@ async def get_user_roles(userid):
sql = "select concat(b.orgtypeid, '.', b.name) as name from userrole a, role b where a.userid=${userid}$ and a.roleid = b.id"
db = DBPools()
roles = []
dbname = await get_dbname()
dbname = get_dbname()
async with db.sqlorContext(dbname) as sor:
recs = await sor.sqlExe(sql, {'userid':userid})
if len(recs) < 1:
@ -88,7 +88,7 @@ async def register_user(sor, ns):
await create_user(sor, ns)
return id
async def get_dbname():
def get_dbname():
f = get_serverenv('get_module_dbname')
if f is None:
raise Exception('get_module_dbname() not defined')
@ -97,7 +97,7 @@ async def get_dbname():
async def checkUserPassword(request, username, password):
db = DBPools()
dbname = await get_dbname()
dbname = get_dbname()
async with db.sqlorContext(dbname) as sor:
sql = "select * from users where username=${username}$ and password=${password}$"
recs = await sor.sqlExe(sql, {'username':username, 'password':password})
@ -144,7 +144,7 @@ right join userrole c on b.roleid = c.roleid
where c.userid = ${userid}$
"""
dbname = await get_dbname()
dbname = get_dbname()
db = DBPools()
async with db.sqlorContext(dbname) as sor:
perms = await sor.R('permission', {'path':path})