fix: 移除get_organizations的过滤条件,返回所有组织;添加错误日志

This commit is contained in:
yumoqing 2026-05-31 15:41:21 +08:00
parent 314da7ae44
commit 37c6814b2d
2 changed files with 25 additions and 18 deletions

View File

@ -1,12 +1,15 @@
result = [] result = []
async with get_sor_context(request._run_ns, 'rbac') as sor: try:
user_orgid = await get_userorgid() async with get_sor_context(request._run_ns, 'rbac') as sor:
all_orgs = await sor.sqlExe( orgs = await sor.sqlExe(
"select id, orgname from organization where id = ${id}$ or parentid = ${id}$ order by orgname", "select id, orgname from organization order by orgname",
{'id': user_orgid} {}
) )
if all_orgs: if orgs:
result = [{'value': r.id, 'text': r.orgname} for r in all_orgs] for r in orgs:
result.append({'value': str(r.id), 'text': r.orgname or ''})
except Exception as e:
debug(f'get_organizations error: {e}')
return json.dumps(result, ensure_ascii=False, default=str) return json.dumps(result, ensure_ascii=False)

View File

@ -1,12 +1,16 @@
result = [] result = []
async with get_sor_context(request._run_ns, 'uapi') as sor: try:
user_orgid = await get_userorgid() async with get_sor_context(request._run_ns, 'uapi') as sor:
apps = await sor.sqlExe( user_orgid = await get_userorgid()
"select id, name from upapp where ownerid = ${ownerid}$ or ownerid is null order by name", apps = await sor.sqlExe(
{'ownerid': user_orgid} "select id, name from upapp order by name",
) {}
if apps: )
result = [{'value': r.id, 'text': r.name} for r in apps] if apps:
for r in apps:
result.append({'value': str(r.id), 'text': r.name or ''})
except Exception as e:
debug(f'get_upapps error: {e}')
return json.dumps(result, ensure_ascii=False, default=str) return json.dumps(result, ensure_ascii=False)