Fix bug in CheckAccountItemModifyRule()

This commit is contained in:
Gucheng Wang
2023-01-07 13:49:06 +08:00
parent b566af8e11
commit 090389b86a
3 changed files with 143 additions and 122 deletions

View File

@ -204,7 +204,7 @@ func GetAccountItemByName(name string, organization *Organization) *AccountItem
func CheckAccountItemModifyRule(accountItem *AccountItem, user *User, lang string) (bool, string) {
switch accountItem.ModifyRule {
case "Admin":
if !(user.IsAdmin || user.IsGlobalAdmin) {
if user == nil || !user.IsAdmin && !user.IsGlobalAdmin {
return false, fmt.Sprintf(i18n.Translate(lang, "organization:Only admin can modify the %s."), accountItem.Name)
}
case "Immutable":