2021-01-05 09:33:45 +01:00
|
|
|
package domain
|
|
|
|
|
|
|
|
import (
|
|
|
|
"golang.org/x/text/language"
|
2021-06-11 13:20:39 +02:00
|
|
|
|
2022-04-27 01:01:45 +02:00
|
|
|
es_models "github.com/zitadel/zitadel/internal/eventstore/v1/models"
|
2021-01-05 09:33:45 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
type Profile struct {
|
|
|
|
es_models.ObjectRoot
|
|
|
|
|
|
|
|
FirstName string
|
|
|
|
LastName string
|
|
|
|
NickName string
|
|
|
|
DisplayName string
|
|
|
|
PreferredLanguage language.Tag
|
|
|
|
Gender Gender
|
|
|
|
PreferredLoginName string
|
|
|
|
LoginNames []string
|
|
|
|
}
|
2021-01-06 11:12:56 +01:00
|
|
|
|
|
|
|
func (p *Profile) IsValid() bool {
|
|
|
|
return p.FirstName != "" && p.LastName != ""
|
|
|
|
}
|
2021-06-11 13:20:39 +02:00
|
|
|
|
|
|
|
func AvatarURL(prefix, resourceOwner, key string) string {
|
|
|
|
if prefix == "" || resourceOwner == "" || key == "" {
|
|
|
|
return ""
|
|
|
|
}
|
2022-02-14 17:22:30 +01:00
|
|
|
return prefix + "/" + resourceOwner + "/" + key
|
2021-06-11 13:20:39 +02:00
|
|
|
}
|