mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-12 02:54:20 +00:00
fix: set gender correctly in userinfo (#3112)
This commit is contained in:
parent
5f3b17c174
commit
52da2354a3
@ -17,7 +17,6 @@ import (
|
|||||||
"github.com/caos/zitadel/internal/errors"
|
"github.com/caos/zitadel/internal/errors"
|
||||||
"github.com/caos/zitadel/internal/query"
|
"github.com/caos/zitadel/internal/query"
|
||||||
"github.com/caos/zitadel/internal/telemetry/tracing"
|
"github.com/caos/zitadel/internal/telemetry/tracing"
|
||||||
user_model "github.com/caos/zitadel/internal/user/model"
|
|
||||||
grant_model "github.com/caos/zitadel/internal/usergrant/model"
|
grant_model "github.com/caos/zitadel/internal/usergrant/model"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -197,7 +196,7 @@ func (o *OPStorage) setUserinfo(ctx context.Context, userInfo oidc.UserInfoSette
|
|||||||
userInfo.SetFamilyName(user.Human.LastName)
|
userInfo.SetFamilyName(user.Human.LastName)
|
||||||
userInfo.SetGivenName(user.Human.FirstName)
|
userInfo.SetGivenName(user.Human.FirstName)
|
||||||
userInfo.SetNickname(user.Human.NickName)
|
userInfo.SetNickname(user.Human.NickName)
|
||||||
userInfo.SetGender(oidc.Gender(user.Human.Gender))
|
userInfo.SetGender(getGender(user.Human.Gender))
|
||||||
userInfo.SetLocale(user.Human.PreferredLanguage)
|
userInfo.SetLocale(user.Human.PreferredLanguage)
|
||||||
userInfo.SetPicture(domain.AvatarURL(o.assetAPIPrefix, user.ResourceOwner, user.Human.AvatarKey))
|
userInfo.SetPicture(domain.AvatarURL(o.assetAPIPrefix, user.ResourceOwner, user.Human.AvatarKey))
|
||||||
} else {
|
} else {
|
||||||
@ -351,13 +350,13 @@ func appendRole(roles map[string]map[string]string, role, orgID, orgPrimaryDomai
|
|||||||
roles[role][orgID] = orgPrimaryDomain
|
roles[role][orgID] = orgPrimaryDomain
|
||||||
}
|
}
|
||||||
|
|
||||||
func getGender(gender user_model.Gender) string {
|
func getGender(gender domain.Gender) oidc.Gender {
|
||||||
switch gender {
|
switch gender {
|
||||||
case user_model.GenderFemale:
|
case domain.GenderFemale:
|
||||||
return "female"
|
return "female"
|
||||||
case user_model.GenderMale:
|
case domain.GenderMale:
|
||||||
return "male"
|
return "male"
|
||||||
case user_model.GenderDiverse:
|
case domain.GenderDiverse:
|
||||||
return "diverse"
|
return "diverse"
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
|
Loading…
Reference in New Issue
Block a user