mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-03 12:30:19 +08:00
feat: fix OIDC address field (#3013)
* feat:add fields of sync-database * feat:add fields of sync-database * feat: add several fields related to the OIDC specification address * feat: add the field Address to Address structure in UserWithoutThirdIdp * fix: delete redundant fields * fix: add Address struct and delete redundant fields
This commit is contained in:
@ -50,48 +50,48 @@ type UserWithoutThirdIdp struct {
|
|||||||
UpdatedTime string `xorm:"varchar(100)" json:"updatedTime"`
|
UpdatedTime string `xorm:"varchar(100)" json:"updatedTime"`
|
||||||
DeletedTime string `xorm:"varchar(100)" json:"deletedTime"`
|
DeletedTime string `xorm:"varchar(100)" json:"deletedTime"`
|
||||||
|
|
||||||
Id string `xorm:"varchar(100) index" json:"id"`
|
Id string `xorm:"varchar(100) index" json:"id"`
|
||||||
Type string `xorm:"varchar(100)" json:"type"`
|
Type string `xorm:"varchar(100)" json:"type"`
|
||||||
Password string `xorm:"varchar(150)" json:"password"`
|
Password string `xorm:"varchar(150)" json:"password"`
|
||||||
PasswordSalt string `xorm:"varchar(100)" json:"passwordSalt"`
|
PasswordSalt string `xorm:"varchar(100)" json:"passwordSalt"`
|
||||||
PasswordType string `xorm:"varchar(100)" json:"passwordType"`
|
PasswordType string `xorm:"varchar(100)" json:"passwordType"`
|
||||||
DisplayName string `xorm:"varchar(100)" json:"displayName"`
|
DisplayName string `xorm:"varchar(100)" json:"displayName"`
|
||||||
FirstName string `xorm:"varchar(100)" json:"firstName"`
|
FirstName string `xorm:"varchar(100)" json:"firstName"`
|
||||||
LastName string `xorm:"varchar(100)" json:"lastName"`
|
LastName string `xorm:"varchar(100)" json:"lastName"`
|
||||||
Avatar string `xorm:"varchar(500)" json:"avatar"`
|
Avatar string `xorm:"varchar(500)" json:"avatar"`
|
||||||
AvatarType string `xorm:"varchar(100)" json:"avatarType"`
|
AvatarType string `xorm:"varchar(100)" json:"avatarType"`
|
||||||
PermanentAvatar string `xorm:"varchar(500)" json:"permanentAvatar"`
|
PermanentAvatar string `xorm:"varchar(500)" json:"permanentAvatar"`
|
||||||
Email string `xorm:"varchar(100) index" json:"email"`
|
Email string `xorm:"varchar(100) index" json:"email"`
|
||||||
EmailVerified bool `json:"emailVerified"`
|
EmailVerified bool `json:"emailVerified"`
|
||||||
Phone string `xorm:"varchar(100) index" json:"phone"`
|
Phone string `xorm:"varchar(100) index" json:"phone"`
|
||||||
CountryCode string `xorm:"varchar(6)" json:"countryCode"`
|
CountryCode string `xorm:"varchar(6)" json:"countryCode"`
|
||||||
Region string `xorm:"varchar(100)" json:"region"`
|
Region string `xorm:"varchar(100)" json:"region"`
|
||||||
Location string `xorm:"varchar(100)" json:"location"`
|
Location string `xorm:"varchar(100)" json:"location"`
|
||||||
Address []string `json:"address"`
|
Address Address `json:"address"`
|
||||||
Affiliation string `xorm:"varchar(100)" json:"affiliation"`
|
Affiliation string `xorm:"varchar(100)" json:"affiliation"`
|
||||||
Title string `xorm:"varchar(100)" json:"title"`
|
Title string `xorm:"varchar(100)" json:"title"`
|
||||||
IdCardType string `xorm:"varchar(100)" json:"idCardType"`
|
IdCardType string `xorm:"varchar(100)" json:"idCardType"`
|
||||||
IdCard string `xorm:"varchar(100) index" json:"idCard"`
|
IdCard string `xorm:"varchar(100) index" json:"idCard"`
|
||||||
Homepage string `xorm:"varchar(100)" json:"homepage"`
|
Homepage string `xorm:"varchar(100)" json:"homepage"`
|
||||||
Bio string `xorm:"varchar(100)" json:"bio"`
|
Bio string `xorm:"varchar(100)" json:"bio"`
|
||||||
Tag string `xorm:"varchar(100)" json:"tag"`
|
Tag string `xorm:"varchar(100)" json:"tag"`
|
||||||
Language string `xorm:"varchar(100)" json:"language"`
|
Language string `xorm:"varchar(100)" json:"language"`
|
||||||
Gender string `xorm:"varchar(100)" json:"gender"`
|
Gender string `xorm:"varchar(100)" json:"gender"`
|
||||||
Birthday string `xorm:"varchar(100)" json:"birthday"`
|
Birthday string `xorm:"varchar(100)" json:"birthday"`
|
||||||
Education string `xorm:"varchar(100)" json:"education"`
|
Education string `xorm:"varchar(100)" json:"education"`
|
||||||
Score int `json:"score"`
|
Score int `json:"score"`
|
||||||
Karma int `json:"karma"`
|
Karma int `json:"karma"`
|
||||||
Ranking int `json:"ranking"`
|
Ranking int `json:"ranking"`
|
||||||
IsDefaultAvatar bool `json:"isDefaultAvatar"`
|
IsDefaultAvatar bool `json:"isDefaultAvatar"`
|
||||||
IsOnline bool `json:"isOnline"`
|
IsOnline bool `json:"isOnline"`
|
||||||
IsAdmin bool `json:"isAdmin"`
|
IsAdmin bool `json:"isAdmin"`
|
||||||
IsForbidden bool `json:"isForbidden"`
|
IsForbidden bool `json:"isForbidden"`
|
||||||
IsDeleted bool `json:"isDeleted"`
|
IsDeleted bool `json:"isDeleted"`
|
||||||
SignupApplication string `xorm:"varchar(100)" json:"signupApplication"`
|
SignupApplication string `xorm:"varchar(100)" json:"signupApplication"`
|
||||||
Hash string `xorm:"varchar(100)" json:"hash"`
|
Hash string `xorm:"varchar(100)" json:"hash"`
|
||||||
PreHash string `xorm:"varchar(100)" json:"preHash"`
|
PreHash string `xorm:"varchar(100)" json:"preHash"`
|
||||||
AccessKey string `xorm:"varchar(100)" json:"accessKey"`
|
AccessKey string `xorm:"varchar(100)" json:"accessKey"`
|
||||||
AccessSecret string `xorm:"varchar(100)" json:"accessSecret"`
|
AccessSecret string `xorm:"varchar(100)" json:"accessSecret"`
|
||||||
|
|
||||||
GitHub string `xorm:"github varchar(100)" json:"github"`
|
GitHub string `xorm:"github varchar(100)" json:"github"`
|
||||||
Google string `xorm:"varchar(100)" json:"google"`
|
Google string `xorm:"varchar(100)" json:"google"`
|
||||||
@ -148,6 +148,15 @@ type ClaimsWithoutThirdIdp struct {
|
|||||||
jwt.RegisteredClaims
|
jwt.RegisteredClaims
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Address struct {
|
||||||
|
Formatted string `json:"formatted"`
|
||||||
|
StreetAddress string `json:"street_address"`
|
||||||
|
Locality string `json:"locality"`
|
||||||
|
Region string `json:"region"`
|
||||||
|
PostalCode string `json:"postal_code"`
|
||||||
|
Country string `json:"country"`
|
||||||
|
}
|
||||||
|
|
||||||
func getShortUser(user *User) *UserShort {
|
func getShortUser(user *User) *UserShort {
|
||||||
res := &UserShort{
|
res := &UserShort{
|
||||||
Owner: user.Owner,
|
Owner: user.Owner,
|
||||||
@ -162,6 +171,13 @@ func getShortUser(user *User) *UserShort {
|
|||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getStreetAddress(user *User) string {
|
||||||
|
if len(user.Address) > 0 {
|
||||||
|
return user.Address[0]
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
func getUserWithoutThirdIdp(user *User) *UserWithoutThirdIdp {
|
func getUserWithoutThirdIdp(user *User) *UserWithoutThirdIdp {
|
||||||
res := &UserWithoutThirdIdp{
|
res := &UserWithoutThirdIdp{
|
||||||
Owner: user.Owner,
|
Owner: user.Owner,
|
||||||
@ -170,24 +186,31 @@ func getUserWithoutThirdIdp(user *User) *UserWithoutThirdIdp {
|
|||||||
UpdatedTime: user.UpdatedTime,
|
UpdatedTime: user.UpdatedTime,
|
||||||
DeletedTime: user.DeletedTime,
|
DeletedTime: user.DeletedTime,
|
||||||
|
|
||||||
Id: user.Id,
|
Id: user.Id,
|
||||||
Type: user.Type,
|
Type: user.Type,
|
||||||
Password: user.Password,
|
Password: user.Password,
|
||||||
PasswordSalt: user.PasswordSalt,
|
PasswordSalt: user.PasswordSalt,
|
||||||
PasswordType: user.PasswordType,
|
PasswordType: user.PasswordType,
|
||||||
DisplayName: user.DisplayName,
|
DisplayName: user.DisplayName,
|
||||||
FirstName: user.FirstName,
|
FirstName: user.FirstName,
|
||||||
LastName: user.LastName,
|
LastName: user.LastName,
|
||||||
Avatar: user.Avatar,
|
Avatar: user.Avatar,
|
||||||
AvatarType: user.AvatarType,
|
AvatarType: user.AvatarType,
|
||||||
PermanentAvatar: user.PermanentAvatar,
|
PermanentAvatar: user.PermanentAvatar,
|
||||||
Email: user.Email,
|
Email: user.Email,
|
||||||
EmailVerified: user.EmailVerified,
|
EmailVerified: user.EmailVerified,
|
||||||
Phone: user.Phone,
|
Phone: user.Phone,
|
||||||
CountryCode: user.CountryCode,
|
CountryCode: user.CountryCode,
|
||||||
Region: user.Region,
|
Region: user.Region,
|
||||||
Location: user.Location,
|
Location: user.Location,
|
||||||
Address: user.Address,
|
Address: Address{
|
||||||
|
Formatted: "",
|
||||||
|
StreetAddress: getStreetAddress(user),
|
||||||
|
Locality: "",
|
||||||
|
Region: "",
|
||||||
|
PostalCode: "",
|
||||||
|
Country: "",
|
||||||
|
},
|
||||||
Affiliation: user.Affiliation,
|
Affiliation: user.Affiliation,
|
||||||
Title: user.Title,
|
Title: user.Title,
|
||||||
IdCardType: user.IdCardType,
|
IdCardType: user.IdCardType,
|
||||||
|
Reference in New Issue
Block a user