mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-03 12:30:19 +08:00
Sync info from 3rd-party if possible.
This commit is contained in:
@ -142,7 +142,7 @@ func GetUserByField(organizationName string, field string, value string) *User {
|
||||
}
|
||||
}
|
||||
|
||||
func LinkUserAccount(user *User, field string, value string) bool {
|
||||
func SetUserField(user *User, field string, value string) bool {
|
||||
affected, err := adapter.engine.Table(user).ID(core.PK{user.Owner, user.Name}).Update(map[string]interface{}{field: value})
|
||||
if err != nil {
|
||||
panic(err)
|
||||
@ -151,6 +151,10 @@ func LinkUserAccount(user *User, field string, value string) bool {
|
||||
return affected != 0
|
||||
}
|
||||
|
||||
func LinkUserAccount(user *User, field string, value string) bool {
|
||||
return SetUserField(user, field, value)
|
||||
}
|
||||
|
||||
func GetUserField(user *User, field string) string {
|
||||
// https://socketloop.com/tutorials/golang-how-to-get-struct-field-and-value-by-name
|
||||
u := reflect.ValueOf(user)
|
||||
|
Reference in New Issue
Block a user