mirror of
https://github.com/zitadel/zitadel.git
synced 2025-01-07 14:07:41 +00:00
47ffa52f0f
* feat(instance): implement create instance with direct machine user and credentials * fix: deprecated add endpoint and variable declaration * fix(instance): update logic for pats and machinekeys * fix(instance): unit test corrections and additional unit test for pats and machinekeys * fix(instance-create): include review changes * fix(instance-create): linter fixes * move iframe usage to solution scenarios configurations * Revert "move iframe usage to solution scenarios configurations" This reverts commit 9db31f3808e6dfcae9907bc574c072436a19865a. * fix merge * fix: add review suggestions Co-authored-by: Livio Spring <livio.a@gmail.com> * fix: add review changes * fix: add review changes for default definitions * fix: add review changes for machinekey details * fix: add machinekey output when setup with machineuser * fix: add changes from review * fix instance converter for machine and allow overwriting of further machine fields Co-authored-by: Livio Spring <livio.a@gmail.com>
46 lines
1.4 KiB
Go
46 lines
1.4 KiB
Go
package admin
|
|
|
|
import (
|
|
"github.com/zitadel/logging"
|
|
"golang.org/x/text/language"
|
|
|
|
user_grpc "github.com/zitadel/zitadel/internal/api/grpc/user"
|
|
"github.com/zitadel/zitadel/internal/command"
|
|
admin_grpc "github.com/zitadel/zitadel/pkg/grpc/admin"
|
|
)
|
|
|
|
func setUpOrgHumanToCommand(human *admin_grpc.SetUpOrgRequest_Human) *command.AddHuman {
|
|
var lang language.Tag
|
|
lang, err := language.Parse(human.Profile.PreferredLanguage)
|
|
logging.OnError(err).Debug("unable to parse language")
|
|
return &command.AddHuman{
|
|
Username: human.UserName,
|
|
FirstName: human.Profile.FirstName,
|
|
LastName: human.Profile.LastName,
|
|
NickName: human.Profile.NickName,
|
|
DisplayName: human.Profile.DisplayName,
|
|
PreferredLanguage: lang,
|
|
Gender: user_grpc.GenderToDomain(human.Profile.Gender),
|
|
Email: setUpOrgHumanEmailToDomain(human.Email),
|
|
Phone: setUpOrgHumanPhoneToDomain(human.Phone),
|
|
Password: human.Password,
|
|
}
|
|
}
|
|
|
|
func setUpOrgHumanEmailToDomain(email *admin_grpc.SetUpOrgRequest_Human_Email) command.Email {
|
|
return command.Email{
|
|
Address: email.Email,
|
|
Verified: email.IsEmailVerified,
|
|
}
|
|
}
|
|
|
|
func setUpOrgHumanPhoneToDomain(phone *admin_grpc.SetUpOrgRequest_Human_Phone) command.Phone {
|
|
if phone == nil {
|
|
return command.Phone{}
|
|
}
|
|
return command.Phone{
|
|
Number: phone.Phone,
|
|
Verified: phone.IsPhoneVerified,
|
|
}
|
|
}
|