2023-02-15 08:14:59 +00:00
|
|
|
package ldap
|
|
|
|
|
2023-03-14 19:20:38 +00:00
|
|
|
import (
|
|
|
|
"golang.org/x/text/language"
|
|
|
|
|
|
|
|
"github.com/zitadel/zitadel/internal/domain"
|
|
|
|
)
|
2023-02-15 08:14:59 +00:00
|
|
|
|
|
|
|
type User struct {
|
2023-08-16 11:29:57 +00:00
|
|
|
ID string `json:"id,omitempty"`
|
|
|
|
FirstName string `json:"firstName,omitempty"`
|
|
|
|
LastName string `json:"lastName,omitempty"`
|
|
|
|
DisplayName string `json:"displayName,omitempty"`
|
|
|
|
NickName string `json:"nickName,omitempty"`
|
|
|
|
PreferredUsername string `json:"preferredUsername,omitempty"`
|
|
|
|
Email domain.EmailAddress `json:"email,omitempty"`
|
|
|
|
EmailVerified bool `json:"emailVerified,omitempty"`
|
|
|
|
Phone domain.PhoneNumber `json:"phone,omitempty"`
|
|
|
|
PhoneVerified bool `json:"phoneVerified,omitempty"`
|
|
|
|
PreferredLanguage language.Tag `json:"preferredLanguage,omitempty"`
|
|
|
|
AvatarURL string `json:"avatarURL,omitempty"`
|
|
|
|
Profile string `json:"profile,omitempty"`
|
2023-02-15 08:14:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func NewUser(
|
|
|
|
id string,
|
|
|
|
firstName string,
|
|
|
|
lastName string,
|
|
|
|
displayName string,
|
|
|
|
nickName string,
|
|
|
|
preferredUsername string,
|
2023-03-14 19:20:38 +00:00
|
|
|
email domain.EmailAddress,
|
2023-02-15 08:14:59 +00:00
|
|
|
emailVerified bool,
|
2023-03-14 19:20:38 +00:00
|
|
|
phone domain.PhoneNumber,
|
2023-02-15 08:14:59 +00:00
|
|
|
phoneVerified bool,
|
|
|
|
preferredLanguage language.Tag,
|
|
|
|
avatarURL string,
|
|
|
|
profile string,
|
|
|
|
) *User {
|
|
|
|
return &User{
|
|
|
|
id,
|
|
|
|
firstName,
|
|
|
|
lastName,
|
|
|
|
displayName,
|
|
|
|
nickName,
|
|
|
|
preferredUsername,
|
|
|
|
email,
|
|
|
|
emailVerified,
|
|
|
|
phone,
|
|
|
|
phoneVerified,
|
|
|
|
preferredLanguage,
|
|
|
|
avatarURL,
|
|
|
|
profile,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (u *User) GetID() string {
|
2023-08-16 11:29:57 +00:00
|
|
|
return u.ID
|
2023-02-15 08:14:59 +00:00
|
|
|
}
|
|
|
|
func (u *User) GetFirstName() string {
|
2023-08-16 11:29:57 +00:00
|
|
|
return u.FirstName
|
2023-02-15 08:14:59 +00:00
|
|
|
}
|
|
|
|
func (u *User) GetLastName() string {
|
2023-08-16 11:29:57 +00:00
|
|
|
return u.LastName
|
2023-02-15 08:14:59 +00:00
|
|
|
}
|
|
|
|
func (u *User) GetDisplayName() string {
|
2023-08-16 11:29:57 +00:00
|
|
|
return u.DisplayName
|
2023-02-15 08:14:59 +00:00
|
|
|
}
|
|
|
|
func (u *User) GetNickname() string {
|
2023-08-16 11:29:57 +00:00
|
|
|
return u.NickName
|
2023-02-15 08:14:59 +00:00
|
|
|
}
|
|
|
|
func (u *User) GetPreferredUsername() string {
|
2023-08-16 11:29:57 +00:00
|
|
|
return u.PreferredUsername
|
2023-02-15 08:14:59 +00:00
|
|
|
}
|
2023-03-14 19:20:38 +00:00
|
|
|
func (u *User) GetEmail() domain.EmailAddress {
|
2023-08-16 11:29:57 +00:00
|
|
|
return u.Email
|
2023-02-15 08:14:59 +00:00
|
|
|
}
|
|
|
|
func (u *User) IsEmailVerified() bool {
|
2023-08-16 11:29:57 +00:00
|
|
|
return u.EmailVerified
|
2023-02-15 08:14:59 +00:00
|
|
|
}
|
2023-03-14 19:20:38 +00:00
|
|
|
func (u *User) GetPhone() domain.PhoneNumber {
|
2023-08-16 11:29:57 +00:00
|
|
|
return u.Phone
|
2023-02-15 08:14:59 +00:00
|
|
|
}
|
|
|
|
func (u *User) IsPhoneVerified() bool {
|
2023-08-16 11:29:57 +00:00
|
|
|
return u.PhoneVerified
|
2023-02-15 08:14:59 +00:00
|
|
|
}
|
|
|
|
func (u *User) GetPreferredLanguage() language.Tag {
|
2023-08-16 11:29:57 +00:00
|
|
|
return u.PreferredLanguage
|
2023-02-15 08:14:59 +00:00
|
|
|
}
|
|
|
|
func (u *User) GetAvatarURL() string {
|
2023-08-16 11:29:57 +00:00
|
|
|
return u.AvatarURL
|
2023-02-15 08:14:59 +00:00
|
|
|
}
|
|
|
|
func (u *User) GetProfile() string {
|
2023-08-16 11:29:57 +00:00
|
|
|
return u.Profile
|
2023-02-15 08:14:59 +00:00
|
|
|
}
|