feat: skip update user ranking if ranking not in accountItem (#3500)

This commit is contained in:
DacongDA
2025-01-14 22:43:49 +08:00
committed by GitHub
parent 19f62a461b
commit 4fc7600865

View File

@ -846,11 +846,14 @@ func AddUser(user *User) (bool, error) {
}
}
count, err := GetUserCount(user.Owner, "", "", "")
if err != nil {
return false, err
rankingItem := GetAccountItemByName("Ranking", organization)
if rankingItem != nil {
count, err := GetUserCount(user.Owner, "", "", "")
if err != nil {
return false, err
}
user.Ranking = int(count + 1)
}
user.Ranking = int(count + 1)
if user.Groups != nil && len(user.Groups) > 0 {
_, err = userEnforcer.UpdateGroupsForUser(user.GetId(), user.Groups)