mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-03 12:30:19 +08:00
Support affiliation sync.
This commit is contained in:
@ -114,7 +114,7 @@ func UpdateUser(id string, user *User) bool {
|
||||
|
||||
user.UpdateUserHash()
|
||||
|
||||
affected, err := adapter.Engine.ID(core.PK{owner, name}).Cols("display_name", "avatar", "address", "affiliation", "tag", "is_admin", "is_global_admin", "is_forbidden", "hash").Update(user)
|
||||
affected, err := adapter.Engine.ID(core.PK{owner, name}).Cols("display_name", "avatar", "address", "affiliation", "score", "tag", "is_admin", "is_global_admin", "is_forbidden", "hash").Update(user)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@ -123,7 +123,7 @@ func UpdateUser(id string, user *User) bool {
|
||||
}
|
||||
|
||||
func UpdateUserForOriginal(user *User) bool {
|
||||
affected, err := adapter.Engine.ID(core.PK{user.Owner, user.Name}).Cols("display_name", "password", "phone", "avatar", "is_forbidden", "hash", "pre_hash").Update(user)
|
||||
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)
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ package object
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/casdoor/casdoor/util"
|
||||
@ -124,7 +125,7 @@ func ClearUserProperties(user *User, providerType string) bool {
|
||||
}
|
||||
|
||||
func calculateHash(user *User) string {
|
||||
s := strings.Join([]string{user.Id, user.Password, user.DisplayName, user.Avatar, user.Phone}, "|")
|
||||
s := strings.Join([]string{user.Id, user.Password, user.DisplayName, user.Avatar, user.Phone, strconv.Itoa(user.Score)}, "|")
|
||||
return util.GetMd5Hash(s)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user