Add getCasdoorColumns().

This commit is contained in:
Yang Luo
2021-12-20 00:26:46 +08:00
parent db56f54b8c
commit e64f181e28
5 changed files with 57 additions and 25 deletions

View File

@ -289,25 +289,6 @@ func UpdateUserForAllFields(id string, user *User) bool {
return affected != 0
}
func UpdateUserForOriginalFields(user *User) bool {
owner, name := util.GetOwnerAndNameFromId(user.GetId())
oldUser := getUser(owner, name)
if oldUser == nil {
return false
}
if user.Avatar != oldUser.Avatar && user.Avatar != "" {
user.PermanentAvatar = getPermanentAvatarUrl(user.Owner, user.Name, user.Avatar)
}
affected, err := adapter.Engine.ID(core.PK{user.Owner, user.Name}).Cols("display_name", "password", "phone", "avatar", "affiliation", "score", "is_forbidden", "hash", "pre_hash").Update(user)
if err != nil {
panic(err)
}
return affected != 0
}
func AddUser(user *User) bool {
if user.Id == "" {
user.Id = util.GenerateId()