mirror of
https://github.com/zitadel/zitadel.git
synced 2025-11-14 15:13:15 +00:00
feat: Private label email policy (#813)
* Label Policy added * save * chore: update docs action * Save * Save * Get colors from DB * Variables inserted * Get images from global directory. * Add tests * Add tests * Corrections from mergerequest * Corrections from mergerequest * Test corrected. * Added colors to all notifications. * Added colors to Corrected text and formatting.all notifications. * Spelling error corrected. * fix: tests * Merge Branch corrected. * Step6 added * Corrections from mergerequest * fix: generate management * Formatted texts. * fix: migrations Co-authored-by: Florian Forster <florian@caos.ch> Co-authored-by: adlerhurst <silvan.reusser@gmail.com> Co-authored-by: Fabiennne <fabienne.gerschwiler@gmail.com>
This commit is contained in:
@@ -705,6 +705,46 @@ func (es *OrgEventstore) ChangeIDPOIDCConfig(ctx context.Context, config *iam_mo
|
||||
return nil, errors.ThrowInternal(nil, "EVENT-Sldk8", "Errors.Internal")
|
||||
}
|
||||
|
||||
func (es *OrgEventstore) AddLabelPolicy(ctx context.Context, policy *iam_model.LabelPolicy) (*iam_model.LabelPolicy, error) {
|
||||
if policy == nil || !policy.IsValid() {
|
||||
return nil, errors.ThrowPreconditionFailed(nil, "EVENT-37rSC", "Errors.Org.LabelPolicyInvalid")
|
||||
}
|
||||
org, err := es.OrgByID(ctx, org_model.NewOrg(policy.AggregateID))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
repoOrg := model.OrgFromModel(org)
|
||||
repoLabelPolicy := iam_es_model.LabelPolicyFromModel(policy)
|
||||
|
||||
addAggregate := LabelPolicyAddedAggregate(es.Eventstore.AggregateCreator(), repoOrg, repoLabelPolicy)
|
||||
err = es_sdk.Push(ctx, es.PushAggregates, repoOrg.AppendEvents, addAggregate)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return iam_es_model.LabelPolicyToModel(repoOrg.LabelPolicy), nil
|
||||
}
|
||||
|
||||
func (es *OrgEventstore) ChangeLabelPolicy(ctx context.Context, policy *iam_model.LabelPolicy) (*iam_model.LabelPolicy, error) {
|
||||
if policy == nil || !policy.IsValid() {
|
||||
return nil, errors.ThrowPreconditionFailed(nil, "EVENT-0NBIw", "Errors.Org.LabelPolicyInvalid")
|
||||
}
|
||||
org, err := es.OrgByID(ctx, org_model.NewOrg(policy.AggregateID))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
repoOrg := model.OrgFromModel(org)
|
||||
repoLabelPolicy := iam_es_model.LabelPolicyFromModel(policy)
|
||||
|
||||
addAggregate := LabelPolicyChangedAggregate(es.Eventstore.AggregateCreator(), repoOrg, repoLabelPolicy)
|
||||
err = es_sdk.Push(ctx, es.PushAggregates, repoOrg.AppendEvents, addAggregate)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return iam_es_model.LabelPolicyToModel(repoOrg.LabelPolicy), nil
|
||||
}
|
||||
|
||||
func (es *OrgEventstore) AddLoginPolicy(ctx context.Context, policy *iam_model.LoginPolicy) (*iam_model.LoginPolicy, error) {
|
||||
if policy == nil || !policy.IsValid() {
|
||||
return nil, errors.ThrowPreconditionFailed(nil, "EVENT-Sjkl9", "Errors.Org.LoginPolicy.Invalid")
|
||||
|
||||
Reference in New Issue
Block a user