fix: 俱乐部超管可审本店提现与订单,禁跨店改单
放宽身份校验与权限推断,列表带回俱乐部信息,写操作按本店范围拦截。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -85,9 +85,39 @@ def has_perm_code(permissions, *codes):
|
||||
return any(c in perms for c in codes)
|
||||
|
||||
|
||||
def has_club_super_perm(permissions):
|
||||
"""本店超级管理 000001(含系统超管 _AllPermissions)。"""
|
||||
if isinstance(permissions, _AllPermissions):
|
||||
return True
|
||||
return '000001' in (permissions or [])
|
||||
|
||||
|
||||
# 本店超管可直接使用的核心业务码(不必再绑集团权限)
|
||||
CLUB_SUPER_IMPLIED_PERMS = frozenset({
|
||||
'002ab', # 平台订单
|
||||
'002ac', # 商家订单
|
||||
'003aa', # 跨平台订单(只读/本店范围仍由 club 闸门控制)
|
||||
'005bb', # 提现审核
|
||||
})
|
||||
|
||||
|
||||
def has_perm_code_or_club_super(permissions, *codes):
|
||||
"""指定业务码,或本店超管 000001(对核心业务码生效)。"""
|
||||
if has_perm_code(permissions, *codes):
|
||||
return True
|
||||
if has_club_super_perm(permissions) and any(c in CLUB_SUPER_IMPLIED_PERMS for c in codes):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def has_merchant_order_permission(permissions):
|
||||
"""商家/链接订单处理权限:002ac 商家订单、002ab 平台订单、003aa 跨平台。"""
|
||||
return has_perm_code(permissions, '002ac', '002ab', '003aa')
|
||||
"""商家/链接订单处理权限:002ac 商家订单、002ab 平台订单、003aa 跨平台;本店超管 000001 亦可。"""
|
||||
return has_perm_code_or_club_super(permissions, '002ac', '002ab', '003aa')
|
||||
|
||||
|
||||
def has_platform_order_permission(permissions):
|
||||
"""平台订单:002ab 或本店超管 000001。"""
|
||||
return has_perm_code_or_club_super(permissions, '002ab')
|
||||
|
||||
|
||||
def _legacy_backend_role_permissions(phone):
|
||||
|
||||
Reference in New Issue
Block a user