feat: 推广 V3.5 实时氢耗并完善导出

This commit is contained in:
lingniu
2026-09-04 15:42:02 +08:00
parent a26179c8fe
commit e402eb5e60
53 changed files with 2855 additions and 320 deletions
@@ -41,14 +41,17 @@ func (p Principal) Clone() Principal {
}
func (p Principal) CanMenu(key string) bool {
if p.UserType == "admin" || p.Role == "admin" {
return true
}
for _, value := range p.MenuKeys {
if value == key {
return true
}
}
// Legacy admin principals did not carry an explicit menu list. Keep those
// principals unrestricted while allowing persisted admin menus to remove a
// sensitive surface such as account management.
if len(p.MenuKeys) == 0 && (p.UserType == "admin" || p.Role == "admin") {
return true
}
return false
}