fix: make SUPER_ADMIN role checks case-insensitive across app

Co-authored-by: aider (openai/DeepSeek-V3.2-Thinking) <aider@aider.chat>
This commit is contained in:
dxc
2026-02-27 17:04:22 +08:00
parent ad8bb5a75d
commit a0993767fe
11 changed files with 32 additions and 19 deletions

View File

@ -221,6 +221,15 @@ class AuthService:
'elements': ['inbound_buy:unit_price', ...]
}
"""
# 超级管理员返回所有权限(通配符)
from app.utils.constants import UserRole
if role_code == UserRole.SUPER_ADMIN:
# 返回通配符,表示拥有所有菜单和元素权限
return {
'menus': ['*'],
'elements': ['*']
}
# 1. 查菜单权限
menu_perms = SysRolePermission.query.filter_by(
role_code=role_code,
@ -243,4 +252,4 @@ class AuthService:
return {
'menus': menu_codes,
'elements': element_codes
}
}