diff --git a/sage_datamart/init.py b/sage_datamart/init.py index 1f10c9d..4258e56 100644 --- a/sage_datamart/init.py +++ b/sage_datamart/init.py @@ -24,12 +24,16 @@ MODULE_NAME = "sage_datamart" async def _resolve_view(request): """解析当前用户角色和机构过滤条件 - 返回 (scope, org_filter) — scope: 'customer'|'distributor', org_filter: org_id + 返回 (scope, org_filter) — scope: 'customer'|'distributor'|None, org_filter: org_id|None + org_filter=None 表示不按机构过滤(平台管理员看全部数据) """ env = request._run_ns userorgid = await env.get_userorgid() scope = CUSTOMER org_filter = userorgid + # 平台根机构('0')无过滤,看全部数据 + if not userorgid or userorgid == '0': + return None, None try: async with get_sor_context(env, MODULE_NAME) as sor: recs = await sor.sqlExe(