- scripts/load_path.py: 按角色分层重写权限矩阵(any/logined/财务角色/分销商角色), 默认先清理 /accounting/ 全部旧授权再重建;财务后台(余额台账/账户/科目/分录/日志/ 信用管理/币种汇率)从 logined 收敛到 owner.superuser/admin/account + reseller.admin/accountant/operator;客户自服务页(已按本机构过滤)保留 logined - accounting/init.py get_accdetail: 补 account.orgid=当前机构 过滤,堵按 accountid 越权查明细 - wwwroot/get_user_balance.dspy: 改为只查登录用户本人余额(原可按任意 username 查他人余额, 且存在 swait 拼写错误导致 500)
26 lines
615 B
Plaintext
26 lines
615 B
Plaintext
# 安全:只允许查询登录用户本人的余额。
|
||
# 历史问题:外部传任意 username 即可查询他人余额(且原文件有 swait 拼写错误,一调用就 500)。
|
||
userid = await get_user()
|
||
env = request._run_ns
|
||
async with get_sor_context(env, 'accounting') as sor:
|
||
sql = """select
|
||
d.username,
|
||
c.name,
|
||
a.balance
|
||
from account a, subject c, users d
|
||
where a.orgid = d.orgid
|
||
and a.subjectid = c.id
|
||
and d.id = ${userid}$
|
||
"""
|
||
recs = await sor.sqlExe(sql, {'userid': userid})
|
||
return {
|
||
'status': 'ok',
|
||
'data': recs
|
||
}
|
||
return {
|
||
'status': 'error',
|
||
'data': {
|
||
'message': 'system error'
|
||
}
|
||
}
|