mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-02 03:00:18 +08:00
Fix "Groups is immutable" bug when updating a user
This commit is contained in:
@ -293,7 +293,13 @@ func CheckPermissionForUpdateUser(oldUser, newUser *User, isAdmin bool, lang str
|
||||
itemsChanged = append(itemsChanged, item)
|
||||
}
|
||||
|
||||
if oldUser.Groups == nil {
|
||||
oldUser.Groups = []string{}
|
||||
}
|
||||
oldUserGroupsJson, _ := json.Marshal(oldUser.Groups)
|
||||
if newUser.Groups == nil {
|
||||
newUser.Groups = []string{}
|
||||
}
|
||||
newUserGroupsJson, _ := json.Marshal(newUser.Groups)
|
||||
if string(oldUserGroupsJson) != string(newUserGroupsJson) {
|
||||
item := GetAccountItemByName("Groups", organization)
|
||||
|
Reference in New Issue
Block a user