fix: 超管聊天权限判定,正确下发 GoEasy AppKey
This commit is contained in:
@@ -53,6 +53,7 @@ from ..utils import (
|
||||
verify_kefu_permission,
|
||||
PERMISSION_TO_SHENFEN,
|
||||
SHENFEN_PROFILE_MAP,
|
||||
has_perm_code,
|
||||
has_fadan_view_permission,
|
||||
has_merchant_order_permission,
|
||||
check_fadan_permission,
|
||||
@@ -1299,7 +1300,9 @@ class KefuChatPermissionsView(APIView):
|
||||
|
||||
# ---------- 验证通过,permissions 已经是权限码列表 ----------
|
||||
# 4. 检查是否拥有至少一个聊天权限
|
||||
has_chat_perm = any(p in CHAT_PERM_CODES for p in permissions)
|
||||
# 必须用 has_perm_code:系统超管是 _AllPermissions,
|
||||
# 「any(p in CHAT_PERM_CODES for p in permissions)」会漏掉超管(列表里往往只有 000001)
|
||||
has_chat_perm = has_perm_code(permissions, *CHAT_PERM_CODES)
|
||||
|
||||
# 5. 若有聊天权限,获取 GoEasy AppKey
|
||||
goeasy_appkey = ''
|
||||
@@ -1337,7 +1340,7 @@ class KefuImUserClubFilterView(APIView):
|
||||
kefu_obj, permissions = verify_kefu_permission(request, phone or None)
|
||||
if kefu_obj is None:
|
||||
return permissions
|
||||
if not any(p in CHAT_PERM_CODES for p in permissions):
|
||||
if not has_perm_code(permissions, *CHAT_PERM_CODES):
|
||||
return Response({'code': 403, 'msg': '无聊天权限', 'data': None})
|
||||
|
||||
raw_ids = request.data.get('im_ids') or request.data.get('ids') or []
|
||||
|
||||
Reference in New Issue
Block a user