fix: 后台用户菜单对俱乐部超级管理000001可见(page_id兜底)
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -30,10 +30,14 @@ def _has_super_perm(permissions):
|
||||
|
||||
|
||||
def _page_visible(page, permissions, user):
|
||||
page_id = getattr(page, 'page_id', '') or ''
|
||||
|
||||
if page.require_group_manage:
|
||||
return can_manage_admin_assignments(user)
|
||||
|
||||
if getattr(page, 'require_admin_user_manage', False):
|
||||
# 后台用户:本店超级管理 000001 / 集团 / 系统超管均可。
|
||||
# 注意:历史上 DB 模型缺 require_admin_user_manage 字段,导致该页永远不可见,必须按 page_id 兜底。
|
||||
if page_id == 'admin.user' or getattr(page, 'require_admin_user_manage', False):
|
||||
return can_access_admin_user_management(user, permissions)
|
||||
|
||||
if page.require_super:
|
||||
@@ -165,6 +169,7 @@ def build_menu_access_payload(request, username=None):
|
||||
|
||||
path_by_id = {p.page_id: p.path for p in pages if p.path}
|
||||
visible_paths = [path_by_id[pid] for pid in visible_ids if pid in path_by_id]
|
||||
is_super = _has_super_perm(permissions) or is_system_super_admin(request.user)
|
||||
return {
|
||||
'visible_page_ids': sorted(set(visible_ids)),
|
||||
'visible_paths': visible_paths,
|
||||
@@ -178,6 +183,7 @@ def build_menu_access_payload(request, username=None):
|
||||
'roles_in_scope': roles_detail,
|
||||
'can_switch_club': bool(club_ctx.get('can_switch_club')),
|
||||
'is_group_admin': bool(club_ctx.get('is_group_admin')),
|
||||
'is_super': bool(is_super),
|
||||
'menu_ready': True,
|
||||
'menu_source': menu_source,
|
||||
}, None
|
||||
|
||||
Reference in New Issue
Block a user