mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-06 17:22:28 +00:00
feat: e-mail templates (#1158)
* View definition added * Get templates and texts from the database. * Fill in texts in templates * Fill in texts in templates * Client API added * Weekly backup * Weekly backup * Daily backup * Weekly backup * Tests added * Corrections from merge branch * Fixes from pull request review
This commit is contained in:
@@ -25,6 +25,8 @@ type Org struct {
|
||||
Members []*OrgMember `json:"-"`
|
||||
OrgIAMPolicy *iam_es_model.OrgIAMPolicy `json:"-"`
|
||||
LabelPolicy *iam_es_model.LabelPolicy `json:"-"`
|
||||
MailTemplate *iam_es_model.MailTemplate `json:"-"`
|
||||
MailTexts []*iam_es_model.MailText `json:"-"`
|
||||
IDPs []*iam_es_model.IDPConfig `json:"-"`
|
||||
LoginPolicy *iam_es_model.LoginPolicy `json:"-"`
|
||||
PasswordComplexityPolicy *iam_es_model.PasswordComplexityPolicy `json:"-"`
|
||||
@@ -36,11 +38,13 @@ func OrgFromModel(org *org_model.Org) *Org {
|
||||
members := OrgMembersFromModel(org.Members)
|
||||
domains := OrgDomainsFromModel(org.Domains)
|
||||
idps := iam_es_model.IDPConfigsFromModel(org.IDPs)
|
||||
mailTexts := iam_es_model.MailTextsFromModel(org.MailTexts)
|
||||
converted := &Org{
|
||||
ObjectRoot: org.ObjectRoot,
|
||||
Name: org.Name,
|
||||
State: int32(org.State),
|
||||
Domains: domains,
|
||||
MailTexts: mailTexts,
|
||||
Members: members,
|
||||
IDPs: idps,
|
||||
}
|
||||
@@ -53,6 +57,9 @@ func OrgFromModel(org *org_model.Org) *Org {
|
||||
if org.LabelPolicy != nil {
|
||||
converted.LabelPolicy = iam_es_model.LabelPolicyFromModel(org.LabelPolicy)
|
||||
}
|
||||
if org.MailTemplate != nil {
|
||||
converted.MailTemplate = iam_es_model.MailTemplateFromModel(org.MailTemplate)
|
||||
}
|
||||
if org.PasswordComplexityPolicy != nil {
|
||||
converted.PasswordComplexityPolicy = iam_es_model.PasswordComplexityPolicyFromModel(org.PasswordComplexityPolicy)
|
||||
}
|
||||
@@ -72,6 +79,7 @@ func OrgToModel(org *Org) *org_model.Org {
|
||||
State: org_model.OrgState(org.State),
|
||||
Domains: OrgDomainsToModel(org.Domains),
|
||||
Members: OrgMembersToModel(org.Members),
|
||||
MailTexts: iam_es_model.MailTextsToModel(org.MailTexts),
|
||||
IDPs: iam_es_model.IDPConfigsToModel(org.IDPs),
|
||||
}
|
||||
if org.OrgIAMPolicy != nil {
|
||||
@@ -83,6 +91,9 @@ func OrgToModel(org *Org) *org_model.Org {
|
||||
if org.LabelPolicy != nil {
|
||||
converted.LabelPolicy = iam_es_model.LabelPolicyToModel(org.LabelPolicy)
|
||||
}
|
||||
if org.MailTemplate != nil {
|
||||
converted.MailTemplate = iam_es_model.MailTemplateToModel(org.MailTemplate)
|
||||
}
|
||||
if org.PasswordComplexityPolicy != nil {
|
||||
converted.PasswordComplexityPolicy = iam_es_model.PasswordComplexityPolicyToModel(org.PasswordComplexityPolicy)
|
||||
}
|
||||
@@ -199,6 +210,18 @@ func (o *Org) AppendEvent(event *es_models.Event) (err error) {
|
||||
err = o.appendAddIdpProviderToLoginPolicyEvent(event)
|
||||
case LoginPolicyIDPProviderRemoved:
|
||||
err = o.appendRemoveIdpProviderFromLoginPolicyEvent(event)
|
||||
case MailTemplateAdded:
|
||||
err = o.appendAddMailTemplateEvent(event)
|
||||
case MailTemplateChanged:
|
||||
err = o.appendChangeMailTemplateEvent(event)
|
||||
case MailTemplateRemoved:
|
||||
o.appendRemoveMailTemplateEvent(event)
|
||||
case MailTextAdded:
|
||||
err = o.appendAddMailTextEvent(event)
|
||||
case MailTextChanged:
|
||||
err = o.appendChangeMailTextEvent(event)
|
||||
case MailTextRemoved:
|
||||
o.appendRemoveMailTextEvent(event)
|
||||
case LoginPolicySecondFactorAdded:
|
||||
err = o.appendAddSecondFactorToLoginPolicyEvent(event)
|
||||
case LoginPolicySecondFactorRemoved:
|
||||
|
||||
Reference in New Issue
Block a user