fix: 三个模块 update endpoint 统一 Default Deny + 权限码全量对齐 sys_element

This commit is contained in:
yueli
2026-07-20 14:26:22 +08:00
parent 3dca2b9254
commit d80edc961c
3 changed files with 84 additions and 13 deletions

View File

@ -182,9 +182,9 @@ def update_buy(id):
'global_print_id': 'inbound_buy:global_print_id',
'sku': 'inbound_buy:sku',
'barcode': 'inbound_buy:barcode',
'in_date': 'inbound_buy:in_date',
'serial_number': 'inbound_buy:serial_number',
'batch_number': 'inbound_buy:batch_number',
'in_date': 'inbound_buy:inbound_date',
'serial_number': 'inbound_buy:sn_bn',
'batch_number': 'inbound_buy:sn_bn',
'status': 'inbound_buy:status',
'in_quantity': 'inbound_buy:in_quantity',
'stock_quantity': 'inbound_buy:stock_quantity',
@ -198,9 +198,6 @@ def update_buy(id):
'currency': 'inbound_buy:currency',
'exchange_rate': 'inbound_buy:exchange_rate',
'supplier_name': 'inbound_buy:supplier_name',
'buyer_name': 'inbound_buy:buyer_name',
'buyer_email': 'inbound_buy:buyer_email',
'original_link': 'inbound_buy:original_link',
'detail_link': 'inbound_buy:detail_link',
'arrival_photo': 'inbound_buy:arrival_photo',
'inspection_report': 'inbound_buy:inspection_report',
@ -210,12 +207,18 @@ def update_buy(id):
'unit': 'inbound_buy:unit',
'material_type': 'inbound_buy:material_type',
'company_name': 'inbound_buy:company_name',
'purchaser': 'inbound_buy:purchaser',
'purchaser_email': 'inbound_buy:purchaser_email',
'source_link': 'inbound_buy:source_link',
'request_id': 'inbound_buy:request_id',
'print_copies': 'inbound_buy:print_copies',
}
# 复制一份,避免遍历时修改字典
for field in list(data.keys()):
perm_code = field_to_perm.get(field)
if not perm_code:
continue # 不在映射中的字段跳过(不参与权限过滤)
if perm_code is None:
data.pop(field, None) # Default Deny: 不在映射中的字段直接剥离
continue
# 提取不带前缀的基础权限码(如 'serial_number')
base_perm_code = perm_code.split(':')[-1] if ':' in perm_code else perm_code
# 如果用户的权限列表中,既没有长格式,也没有短格式,才移除该字段