feat: 推广 V3.5 实时氢耗并完善导出
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user