2021-01-05 08:33:45 +00:00
|
|
|
package domain
|
|
|
|
|
|
|
|
import (
|
|
|
|
"golang.org/x/text/language"
|
2021-06-11 11:20:39 +00:00
|
|
|
|
|
|
|
es_models "github.com/caos/zitadel/internal/eventstore/v1/models"
|
2021-01-05 08:33:45 +00: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 10:12:56 +00:00
|
|
|
|
|
|
|
func (p *Profile) IsValid() bool {
|
|
|
|
return p.FirstName != "" && p.LastName != ""
|
|
|
|
}
|
2021-06-11 11:20:39 +00:00
|
|
|
|
|
|
|
func AvatarURL(prefix, resourceOwner, key string) string {
|
|
|
|
if prefix == "" || resourceOwner == "" || key == "" {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
return prefix + resourceOwner + "/" + key
|
|
|
|
}
|