From ebd4b4a99e0568a3215a04896cefa75cdbcea649 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Tue, 2 Jun 2026 17:27:05 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20get=5Fdata=5Ftmpl=20=E6=B3=A8=E5=85=A5?= =?UTF-8?q?=20logined=20=E8=BF=87=E6=BB=A4=E6=9D=A1=E4=BB=B6=E5=88=B0=20da?= =?UTF-8?q?ta=5Ffilter?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 确保 logined_userorgid 和 logined_userid 始终作为过滤条件 - 统一 filterjson 为 AND 结构后追加 - 解决有 data_filter 时 ownerid/userid 隔离失效的问题 --- xls2ddl/tmpls.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/xls2ddl/tmpls.py b/xls2ddl/tmpls.py index eb70cbf..577af52 100644 --- a/xls2ddl/tmpls.py +++ b/xls2ddl/tmpls.py @@ -159,6 +159,20 @@ ori_fields = json.loads(fields_str) if not filterjson: fields = [ f['name'] for f in ori_fields ] filterjson = default_filterjson(fields, ns) +{% if logined_userorgid or logined_userid %} +# 确保 logined 过滤条件始终生效 +if filterjson: + if not isinstance(filterjson, dict) or 'AND' not in filterjson: + filterjson = {'AND': [filterjson] if filterjson else []} +{% if logined_userorgid %} + filterjson['AND'].append({'field': '{{logined_userorgid}}', 'op': '=', 'var': '__logined_orgid__'}) + ns['__logined_orgid__'] = userorgid +{% endif %} +{% if logined_userid %} + filterjson['AND'].append({'field': '{{logined_userid}}', 'op': '=', 'var': '__logined_uid__'}) + ns['__logined_uid__'] = userid +{% endif %} +{% endif %} filterdic = ns.copy() filterdic['filterstr'] = '' filterdic['userorgid'] = '${userorgid}$'