revert: restore gvsdsdk role/permission APIs; keep KefuProfile login fix

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
XingQue
2026-06-29 00:02:40 +08:00
parent 42cb117a8a
commit dd9e4afa49
4 changed files with 203 additions and 165 deletions

View File

@@ -102,19 +102,15 @@ def is_system_super_admin(user):
def is_kefu_backend_account(user):
"""可登录客服后台:超管 / UserType=kefu / KefuProfile / 旧表 user_role 有绑定"""
"""可登录客服后台:超管 / UserType=kefu / 有正常 KefuProfile。"""
if is_system_super_admin(user):
return True
if getattr(user, 'UserType', '') == 'kefu':
return True
try:
kefu = user.KefuProfile
if kefu.zhuangtai == 1:
return True
return user.KefuProfile.zhuangtai == 1
except Exception:
pass
from backend.utils import has_legacy_backend_binding
return has_legacy_backend_binding(user)
return False
def can_manage_admin_assignments(user, permissions=None):