mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-07 16:20:28 +08:00
feat: add missing account items in CheckPermissionForUpdateUser() (#3094)
This commit is contained in:
@ -393,6 +393,20 @@ func CheckPermissionForUpdateUser(oldUser, newUser *User, isAdmin bool, lang str
|
|||||||
itemsChanged = append(itemsChanged, item)
|
itemsChanged = append(itemsChanged, item)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if oldUser.Address == nil {
|
||||||
|
oldUser.Address = []string{}
|
||||||
|
}
|
||||||
|
oldUserAddressJson, _ := json.Marshal(oldUser.Address)
|
||||||
|
|
||||||
|
if newUser.Address == nil {
|
||||||
|
newUser.Address = []string{}
|
||||||
|
}
|
||||||
|
newUserAddressJson, _ := json.Marshal(newUser.Address)
|
||||||
|
if string(oldUserAddressJson) != string(newUserAddressJson) {
|
||||||
|
item := GetAccountItemByName("Address", organization)
|
||||||
|
itemsChanged = append(itemsChanged, item)
|
||||||
|
}
|
||||||
|
|
||||||
if newUser.FaceIds != nil {
|
if newUser.FaceIds != nil {
|
||||||
item := GetAccountItemByName("Face ID", organization)
|
item := GetAccountItemByName("Face ID", organization)
|
||||||
itemsChanged = append(itemsChanged, item)
|
itemsChanged = append(itemsChanged, item)
|
||||||
@ -426,6 +440,31 @@ func CheckPermissionForUpdateUser(oldUser, newUser *User, isAdmin bool, lang str
|
|||||||
itemsChanged = append(itemsChanged, item)
|
itemsChanged = append(itemsChanged, item)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if oldUser.Karma != newUser.Karma {
|
||||||
|
item := GetAccountItemByName("Karma", organization)
|
||||||
|
itemsChanged = append(itemsChanged, item)
|
||||||
|
}
|
||||||
|
|
||||||
|
if oldUser.Language != newUser.Language {
|
||||||
|
item := GetAccountItemByName("Language", organization)
|
||||||
|
itemsChanged = append(itemsChanged, item)
|
||||||
|
}
|
||||||
|
|
||||||
|
if oldUser.Ranking != newUser.Ranking {
|
||||||
|
item := GetAccountItemByName("Ranking", organization)
|
||||||
|
itemsChanged = append(itemsChanged, item)
|
||||||
|
}
|
||||||
|
|
||||||
|
if oldUser.Currency != newUser.Currency {
|
||||||
|
item := GetAccountItemByName("Currency", organization)
|
||||||
|
itemsChanged = append(itemsChanged, item)
|
||||||
|
}
|
||||||
|
|
||||||
|
if oldUser.Hash != newUser.Hash {
|
||||||
|
item := GetAccountItemByName("Hash", organization)
|
||||||
|
itemsChanged = append(itemsChanged, item)
|
||||||
|
}
|
||||||
|
|
||||||
for _, accountItem := range itemsChanged {
|
for _, accountItem := range itemsChanged {
|
||||||
|
|
||||||
if pass, err := CheckAccountItemModifyRule(accountItem, isAdmin, lang); !pass {
|
if pass, err := CheckAccountItemModifyRule(accountItem, isAdmin, lang); !pass {
|
||||||
|
Reference in New Issue
Block a user