feat: mail tempaltes/texts and step 10 (#1266)

* feat: mail template/text events

* feat: mail template/text events

* feat: mail template/text on iam and org

* feat: setup step 10

* fix: add template event

* fix: add unique constraints

* Update internal/static/i18n/de.yaml

Co-authored-by: Livio Amstutz <[email protected]>

* Update internal/static/i18n/de.yaml

Co-authored-by: Livio Amstutz <[email protected]>

* Update internal/static/i18n/de.yaml

Co-authored-by: Livio Amstutz <[email protected]>

* Update internal/static/i18n/de.yaml

Co-authored-by: Livio Amstutz <[email protected]>

* Update internal/v2/command/iam_policy_mail_template.go

Co-authored-by: Livio Amstutz <[email protected]>

* Update internal/v2/command/org_policy_mail_text.go

Co-authored-by: Livio Amstutz <[email protected]>

* Update internal/v2/command/iam_policy_mail_template.go

Co-authored-by: Livio Amstutz <[email protected]>

* Update internal/v2/command/iam_policy_mail_text.go

Co-authored-by: Livio Amstutz <[email protected]>

* Update internal/v2/command/iam_policy_mail_text.go

Co-authored-by: Livio Amstutz <[email protected]>

* Update internal/v2/command/org_policy_mail_template.go

Co-authored-by: Livio Amstutz <[email protected]>

* Update internal/v2/command/org_policy_mail_template.go

Co-authored-by: Livio Amstutz <[email protected]>

* Update internal/v2/command/org_policy_mail_text.go

Co-authored-by: Livio Amstutz <[email protected]>

* fix: org iam policy

Co-authored-by: Livio Amstutz <[email protected]>
This commit is contained in:
Fabi
2021-02-10 10:48:40 +01:00
committed by GitHub
co-authored by Livio Amstutz
parent b0bcc13a92
commit fbc75d89b2
48 changed files with 1689 additions and 287 deletions
+16 -21
View File
@@ -2,15 +2,14 @@ package command
import (
"context"
iam_model "github.com/caos/zitadel/internal/iam/model"
"github.com/caos/logging"
"github.com/caos/zitadel/internal/v2/domain"
iam_repo "github.com/caos/zitadel/internal/v2/repository/iam"
)
type Step10 struct {
DefaultMailTemplate iam_model.MailTemplate
DefaultMailTexts []iam_model.MailText
DefaultMailTemplate domain.MailTemplate
DefaultMailTexts []domain.MailText
}
func (s *Step10) Step() domain.Step {
@@ -23,23 +22,19 @@ func (s *Step10) execute(ctx context.Context, commandSide *CommandSide) error {
func (r *CommandSide) SetupStep10(ctx context.Context, step *Step10) error {
fn := func(iam *IAMWriteModel) (*iam_repo.Aggregate, error) {
//multiFactorModel := NewIAMMultiFactorWriteModel()
//iamAgg := IAMAggregateFromWriteModel(&multiFactorModel.MultiFactoryWriteModel.WriteModel)
//if !step.Passwordless {
// return iamAgg, nil
//}
//err := setPasswordlessAllowedInPolicy(ctx, r, iamAgg)
//if err != nil {
// return nil, err
//}
//logging.Log("SETUP-AEG2t").Info("allowed passwordless in login policy")
//err = r.addMultiFactorToDefaultLoginPolicy(ctx, iamAgg, multiFactorModel, domain.MultiFactorTypeU2FWithPIN)
//if err != nil {
// return nil, err
//}
//logging.Log("SETUP-ADfng").Info("added passwordless to MFA login policy")
//return iamAgg, err
return nil, nil
iamAgg := IAMAggregateFromWriteModel(&iam.WriteModel)
err := r.addDefaultMailTemplate(ctx, iamAgg, NewIAMMailTemplateWriteModel(), &step.DefaultMailTemplate)
if err != nil {
return nil, err
}
for _, text := range step.DefaultMailTexts {
r.addDefaultMailText(ctx, iamAgg, NewIAMMailTextWriteModel(text.MailTextType, text.Language), &text)
if err != nil {
return nil, err
}
}
logging.Log("SETUP-3N9fs").Info("default mail template/text set up")
return iamAgg, nil
}
return r.setup(ctx, step, fn)
}