mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-06 22:32:16 +00:00
fix: refactor setup (#1152)
* add setup steps * refactoring * omitempty * cleanup * fixes
This commit is contained in:
@@ -22,6 +22,14 @@ type Step1 struct {
|
||||
//pwComplexityPolicy *iam_model.PasswordComplexityPolicyView
|
||||
}
|
||||
|
||||
func (s *Step1) Step() domain.Step {
|
||||
return domain.Step1
|
||||
}
|
||||
|
||||
func (s *Step1) execute(ctx context.Context, commandSide *CommandSide) error {
|
||||
return commandSide.SetupStep1(ctx, commandSide.iamID, s)
|
||||
}
|
||||
|
||||
type LoginPolicy struct {
|
||||
AllowRegister bool
|
||||
AllowUsernamePassword bool
|
||||
@@ -63,14 +71,10 @@ type OIDCApp struct {
|
||||
DevMode bool
|
||||
}
|
||||
|
||||
func (r *CommandSide) SetupStep1(ctx context.Context, iamID string, step1 Step1) error {
|
||||
iam, err := r.iamByID(ctx, iamID)
|
||||
if err != nil && !caos_errs.IsNotFound(err) {
|
||||
return err
|
||||
}
|
||||
func (r *CommandSide) SetupStep1(ctx context.Context, iamID string, step1 *Step1) error {
|
||||
iamAgg := iam_repo.NewAggregate(r.iamID, "", 0)
|
||||
//create default login policy
|
||||
iamAgg, err := r.addDefaultLoginPolicy(ctx,
|
||||
NewIAMLoginPolicyWriteModel(iam.AggregateID),
|
||||
err := r.addDefaultLoginPolicy(ctx, iamAgg, NewIAMLoginPolicyWriteModel(iamAgg.ID()),
|
||||
&domain.LoginPolicy{
|
||||
AllowUsernamePassword: step1.DefaultLoginPolicy.AllowUsernamePassword,
|
||||
AllowRegister: step1.DefaultLoginPolicy.AllowRegister,
|
||||
|
||||
Reference in New Issue
Block a user