mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-04 05:12:16 +00:00
chore: rename IAM to instance (#11351)
# Which Problems Are Solved In many cases IAM was used where instance was meant. # How the Problems Are Solved - Rename wrong usage of IAM to instance all over the code base. - Add an agents.md which explains the terms used in Zitadel's architecture. # Additional Context - closes #11280 --------- Co-authored-by: Copilot <[email protected]> Co-authored-by: muhlemmer <[email protected]> Co-authored-by: Copilot <[email protected]> Co-authored-by: Marco A. <[email protected]>
This commit is contained in:
co-authored by
Copilot
muhlemmer
Copilot
Marco A.
parent
67a02a6aeb
commit
5a2181bcec
@@ -32,14 +32,14 @@ func (c *Commands) AddDefaultMailTemplate(ctx context.Context, policy *domain.Ma
|
||||
|
||||
func (c *Commands) addDefaultMailTemplate(ctx context.Context, instanceAgg *eventstore.Aggregate, addedPolicy *InstanceMailTemplateWriteModel, policy *domain.MailTemplate) (eventstore.Command, error) {
|
||||
if !policy.IsValid() {
|
||||
return nil, zerrors.ThrowInvalidArgument(nil, "INSTANCE-fm9sd", "Errors.IAM.MailTemplate.Invalid")
|
||||
return nil, zerrors.ThrowInvalidArgument(nil, "INSTANCE-fm9sd", "Errors.Instance.MailTemplate.Invalid")
|
||||
}
|
||||
err := c.eventstore.FilterToQueryReducer(ctx, addedPolicy)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if addedPolicy.State == domain.PolicyStateActive {
|
||||
return nil, zerrors.ThrowAlreadyExists(nil, "INSTANCE-5n8fs", "Errors.IAM.MailTemplate.AlreadyExists")
|
||||
return nil, zerrors.ThrowAlreadyExists(nil, "INSTANCE-5n8fs", "Errors.Instance.MailTemplate.AlreadyExists")
|
||||
}
|
||||
|
||||
return instance.NewMailTemplateAddedEvent(ctx, instanceAgg, policy.Template), nil
|
||||
@@ -63,7 +63,7 @@ func (c *Commands) ChangeDefaultMailTemplate(ctx context.Context, policy *domain
|
||||
|
||||
func (c *Commands) changeDefaultMailTemplate(ctx context.Context, policy *domain.MailTemplate) (*InstanceMailTemplateWriteModel, eventstore.Command, error) {
|
||||
if !policy.IsValid() {
|
||||
return nil, nil, zerrors.ThrowInvalidArgument(nil, "INSTANCE-4m9ds", "Errors.IAM.MailTemplate.Invalid")
|
||||
return nil, nil, zerrors.ThrowInvalidArgument(nil, "INSTANCE-4m9ds", "Errors.Instance.MailTemplate.Invalid")
|
||||
}
|
||||
existingPolicy, err := c.defaultMailTemplateWriteModelByID(ctx)
|
||||
if err != nil {
|
||||
@@ -71,13 +71,13 @@ func (c *Commands) changeDefaultMailTemplate(ctx context.Context, policy *domain
|
||||
}
|
||||
|
||||
if existingPolicy.State == domain.PolicyStateUnspecified || existingPolicy.State == domain.PolicyStateRemoved {
|
||||
return nil, nil, zerrors.ThrowNotFound(nil, "INSTANCE-2N8fs", "Errors.IAM.MailTemplate.NotFound")
|
||||
return nil, nil, zerrors.ThrowNotFound(nil, "INSTANCE-2N8fs", "Errors.Instance.MailTemplate.NotFound")
|
||||
}
|
||||
|
||||
instanceAgg := InstanceAggregateFromWriteModel(&existingPolicy.MailTemplateWriteModel.WriteModel)
|
||||
changedEvent, hasChanged := existingPolicy.NewChangedEvent(ctx, instanceAgg, policy.Template)
|
||||
if !hasChanged {
|
||||
return nil, nil, zerrors.ThrowPreconditionFailed(nil, "INSTANCE-3nfsG", "Errors.IAM.MailTemplate.NotChanged")
|
||||
return nil, nil, zerrors.ThrowPreconditionFailed(nil, "INSTANCE-3nfsG", "Errors.Instance.MailTemplate.NotChanged")
|
||||
}
|
||||
|
||||
return existingPolicy, changedEvent, nil
|
||||
|
||||
Reference in New Issue
Block a user