mirror of
https://github.com/andwati/zitadel.git
synced 2026-12-04 18:08:50 +00:00
fix: push events (#1262)
* fix: push events instead of aggregates * fix: tests * try without aggregate methods and with aggregate methods * fix: change push aggregate to push events * fix: change push aggregate to push events * fix: change push aggregate to push events * fix: change push aggregate to push events * fix: change push aggregate to push events * fix: change push aggregate to push events * fix: change push aggregate to push events * fix: change push aggregate to push events * fix: change push aggregate to push events * fix: change push aggregate to push events * fix: client secret * fix: query eventtypes * fix: query eventtypes * fix: eventstore index * fix: index * fix: merge new eventstore * fix: remove unnecessary todos * fix: remove unnecessary todos Co-authored-by: Fabiennne <[email protected]>
This commit is contained in:
@@ -1,9 +1,7 @@
|
||||
package iam
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/caos/zitadel/internal/eventstore/v2"
|
||||
"github.com/caos/zitadel/internal/v2/domain"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -18,13 +16,3 @@ const (
|
||||
type Aggregate struct {
|
||||
eventstore.Aggregate
|
||||
}
|
||||
|
||||
func (a *Aggregate) PushStepStarted(ctx context.Context, step domain.Step) *Aggregate {
|
||||
a.Aggregate = *a.PushEvents(NewSetupStepStartedEvent(ctx, step))
|
||||
return a
|
||||
}
|
||||
|
||||
func (a *Aggregate) PushStepDone(ctx context.Context, step domain.Step) *Aggregate {
|
||||
a.Aggregate = *a.PushEvents(NewSetupStepDoneEvent(ctx, step))
|
||||
return a
|
||||
}
|
||||
|
||||
@@ -27,10 +27,15 @@ func (e *ProjectSetEvent) UniqueConstraints() []*eventstore.EventUniqueConstrain
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewIAMProjectSetEvent(ctx context.Context, projectID string) *ProjectSetEvent {
|
||||
func NewIAMProjectSetEvent(
|
||||
ctx context.Context,
|
||||
aggregate *eventstore.Aggregate,
|
||||
projectID string,
|
||||
) *ProjectSetEvent {
|
||||
return &ProjectSetEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
ProjectSetEventType,
|
||||
),
|
||||
ProjectID: projectID,
|
||||
|
||||
@@ -27,10 +27,15 @@ func (e *GlobalOrgSetEvent) UniqueConstraints() []*eventstore.EventUniqueConstra
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewGlobalOrgSetEventEvent(ctx context.Context, orgID string) *GlobalOrgSetEvent {
|
||||
func NewGlobalOrgSetEventEvent(
|
||||
ctx context.Context,
|
||||
aggregate *eventstore.Aggregate,
|
||||
orgID string,
|
||||
) *GlobalOrgSetEvent {
|
||||
return &GlobalOrgSetEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
GlobalOrgSetEventType,
|
||||
),
|
||||
OrgID: orgID,
|
||||
|
||||
@@ -45,12 +45,14 @@ func SetupStepMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
|
||||
func NewSetupStepDoneEvent(
|
||||
ctx context.Context,
|
||||
aggregate *eventstore.Aggregate,
|
||||
step domain.Step,
|
||||
) *SetupStepEvent {
|
||||
|
||||
return &SetupStepEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
SetupDoneEventType,
|
||||
),
|
||||
Step: step,
|
||||
@@ -59,12 +61,14 @@ func NewSetupStepDoneEvent(
|
||||
|
||||
func NewSetupStepStartedEvent(
|
||||
ctx context.Context,
|
||||
aggregate *eventstore.Aggregate,
|
||||
step domain.Step,
|
||||
) *SetupStepEvent {
|
||||
|
||||
return &SetupStepEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
SetupStartedEventType,
|
||||
),
|
||||
Step: step,
|
||||
|
||||
@@ -23,6 +23,7 @@ type IDPConfigAddedEvent struct {
|
||||
|
||||
func NewIDPConfigAddedEvent(
|
||||
ctx context.Context,
|
||||
aggregate *eventstore.Aggregate,
|
||||
configID,
|
||||
name string,
|
||||
configType domain.IDPConfigType,
|
||||
@@ -31,10 +32,10 @@ func NewIDPConfigAddedEvent(
|
||||
|
||||
return &IDPConfigAddedEvent{
|
||||
IDPConfigAddedEvent: *idpconfig.NewIDPConfigAddedEvent(
|
||||
eventstore.NewBaseEventForPushWithResourceOwner(
|
||||
eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
IDPConfigAddedEventType,
|
||||
domain.IAMID,
|
||||
),
|
||||
configID,
|
||||
name,
|
||||
@@ -59,13 +60,16 @@ type IDPConfigChangedEvent struct {
|
||||
|
||||
func NewIDPConfigChangedEvent(
|
||||
ctx context.Context,
|
||||
resourceOwner,
|
||||
aggregate *eventstore.Aggregate,
|
||||
configID,
|
||||
oldName string,
|
||||
changes []idpconfig.IDPConfigChanges,
|
||||
) (*IDPConfigChangedEvent, error) {
|
||||
changeEvent, err := idpconfig.NewIDPConfigChangedEvent(
|
||||
eventstore.NewBaseEventForPushWithResourceOwner(ctx, IDPConfigChangedEventType, resourceOwner),
|
||||
eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
IDPConfigChangedEventType),
|
||||
configID,
|
||||
oldName,
|
||||
changes,
|
||||
@@ -91,16 +95,16 @@ type IDPConfigRemovedEvent struct {
|
||||
|
||||
func NewIDPConfigRemovedEvent(
|
||||
ctx context.Context,
|
||||
resourceOwner,
|
||||
aggregate *eventstore.Aggregate,
|
||||
configID,
|
||||
name string,
|
||||
) *IDPConfigRemovedEvent {
|
||||
return &IDPConfigRemovedEvent{
|
||||
IDPConfigRemovedEvent: *idpconfig.NewIDPConfigRemovedEvent(
|
||||
eventstore.NewBaseEventForPushWithResourceOwner(
|
||||
eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
IDPConfigRemovedEventType,
|
||||
resourceOwner,
|
||||
),
|
||||
configID,
|
||||
name,
|
||||
@@ -123,6 +127,7 @@ type IDPConfigDeactivatedEvent struct {
|
||||
|
||||
func NewIDPConfigDeactivatedEvent(
|
||||
ctx context.Context,
|
||||
aggregate *eventstore.Aggregate,
|
||||
configID string,
|
||||
) *IDPConfigDeactivatedEvent {
|
||||
|
||||
@@ -130,6 +135,7 @@ func NewIDPConfigDeactivatedEvent(
|
||||
IDPConfigDeactivatedEvent: *idpconfig.NewIDPConfigDeactivatedEvent(
|
||||
eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
IDPConfigDeactivatedEventType,
|
||||
),
|
||||
configID,
|
||||
@@ -152,6 +158,7 @@ type IDPConfigReactivatedEvent struct {
|
||||
|
||||
func NewIDPConfigReactivatedEvent(
|
||||
ctx context.Context,
|
||||
aggregate *eventstore.Aggregate,
|
||||
configID string,
|
||||
) *IDPConfigReactivatedEvent {
|
||||
|
||||
@@ -159,6 +166,7 @@ func NewIDPConfigReactivatedEvent(
|
||||
IDPConfigReactivatedEvent: *idpconfig.NewIDPConfigReactivatedEvent(
|
||||
eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
IDPConfigReactivatedEventType,
|
||||
),
|
||||
configID,
|
||||
|
||||
@@ -21,6 +21,7 @@ type IDPOIDCConfigAddedEvent struct {
|
||||
|
||||
func NewIDPOIDCConfigAddedEvent(
|
||||
ctx context.Context,
|
||||
aggregate *eventstore.Aggregate,
|
||||
clientID,
|
||||
idpConfigID,
|
||||
issuer string,
|
||||
@@ -34,6 +35,7 @@ func NewIDPOIDCConfigAddedEvent(
|
||||
OIDCConfigAddedEvent: *idpconfig.NewOIDCConfigAddedEvent(
|
||||
eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
IDPOIDCConfigAddedEventType,
|
||||
),
|
||||
clientID,
|
||||
@@ -62,11 +64,15 @@ type IDPOIDCConfigChangedEvent struct {
|
||||
|
||||
func NewIDPOIDCConfigChangedEvent(
|
||||
ctx context.Context,
|
||||
aggregate *eventstore.Aggregate,
|
||||
idpConfigID string,
|
||||
changes []idpconfig.OIDCConfigChanges,
|
||||
) (*IDPOIDCConfigChangedEvent, error) {
|
||||
changeEvent, err := idpconfig.NewOIDCConfigChangedEvent(
|
||||
eventstore.NewBaseEventForPush(ctx, IDPOIDCConfigChangedEventType),
|
||||
eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
IDPOIDCConfigChangedEventType),
|
||||
idpConfigID,
|
||||
changes,
|
||||
)
|
||||
|
||||
@@ -2,6 +2,7 @@ package iam
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/caos/zitadel/internal/eventstore/v2"
|
||||
"github.com/caos/zitadel/internal/eventstore/v2/repository"
|
||||
"github.com/caos/zitadel/internal/v2/repository/member"
|
||||
@@ -19,7 +20,7 @@ type MemberAddedEvent struct {
|
||||
|
||||
func NewMemberAddedEvent(
|
||||
ctx context.Context,
|
||||
aggregateID,
|
||||
aggregate *eventstore.Aggregate,
|
||||
userID string,
|
||||
roles ...string,
|
||||
) *MemberAddedEvent {
|
||||
@@ -28,9 +29,9 @@ func NewMemberAddedEvent(
|
||||
MemberAddedEvent: *member.NewMemberAddedEvent(
|
||||
eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
MemberAddedEventType,
|
||||
),
|
||||
aggregateID,
|
||||
userID,
|
||||
roles...,
|
||||
),
|
||||
@@ -52,6 +53,7 @@ type MemberChangedEvent struct {
|
||||
|
||||
func NewMemberChangedEvent(
|
||||
ctx context.Context,
|
||||
aggregate *eventstore.Aggregate,
|
||||
userID string,
|
||||
roles ...string,
|
||||
) *MemberChangedEvent {
|
||||
@@ -59,6 +61,7 @@ func NewMemberChangedEvent(
|
||||
MemberChangedEvent: *member.NewMemberChangedEvent(
|
||||
eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
MemberChangedEventType,
|
||||
),
|
||||
userID,
|
||||
@@ -82,7 +85,7 @@ type MemberRemovedEvent struct {
|
||||
|
||||
func NewMemberRemovedEvent(
|
||||
ctx context.Context,
|
||||
aggregateID,
|
||||
aggregate *eventstore.Aggregate,
|
||||
userID string,
|
||||
) *MemberRemovedEvent {
|
||||
|
||||
@@ -90,9 +93,9 @@ func NewMemberRemovedEvent(
|
||||
MemberRemovedEvent: *member.NewRemovedEvent(
|
||||
eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
MemberRemovedEventType,
|
||||
),
|
||||
aggregateID,
|
||||
userID,
|
||||
),
|
||||
}
|
||||
|
||||
@@ -37,10 +37,14 @@ func (e *MigrateUniqueConstraintEvent) UniqueConstraints() []*eventstore.EventUn
|
||||
return constraints
|
||||
}
|
||||
|
||||
func NewMigrateUniqueConstraintEvent(ctx context.Context, uniqueConstraintMigrations []*domain.UniqueConstraintMigration) *MigrateUniqueConstraintEvent {
|
||||
func NewMigrateUniqueConstraintEvent(
|
||||
ctx context.Context,
|
||||
aggregate *eventstore.Aggregate,
|
||||
uniqueConstraintMigrations []*domain.UniqueConstraintMigration) *MigrateUniqueConstraintEvent {
|
||||
return &MigrateUniqueConstraintEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
UniqueConstraintsMigratedEventType,
|
||||
),
|
||||
uniqueConstraintMigrations: uniqueConstraintMigrations,
|
||||
|
||||
@@ -2,6 +2,7 @@ package iam
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/caos/zitadel/internal/eventstore/v2"
|
||||
"github.com/caos/zitadel/internal/eventstore/v2/repository"
|
||||
"github.com/caos/zitadel/internal/v2/repository/policy"
|
||||
@@ -18,12 +19,16 @@ type LabelPolicyAddedEvent struct {
|
||||
|
||||
func NewLabelPolicyAddedEvent(
|
||||
ctx context.Context,
|
||||
aggregate *eventstore.Aggregate,
|
||||
primaryColor,
|
||||
secondaryColor string,
|
||||
) *LabelPolicyAddedEvent {
|
||||
return &LabelPolicyAddedEvent{
|
||||
LabelPolicyAddedEvent: *policy.NewLabelPolicyAddedEvent(
|
||||
eventstore.NewBaseEventForPush(ctx, LabelPolicyAddedEventType),
|
||||
eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
LabelPolicyAddedEventType),
|
||||
primaryColor,
|
||||
secondaryColor),
|
||||
}
|
||||
@@ -44,10 +49,14 @@ type LabelPolicyChangedEvent struct {
|
||||
|
||||
func NewLabelPolicyChangedEvent(
|
||||
ctx context.Context,
|
||||
aggregate *eventstore.Aggregate,
|
||||
changes []policy.LabelPolicyChanges,
|
||||
) (*LabelPolicyChangedEvent, error) {
|
||||
changedEvent, err := policy.NewLabelPolicyChangedEvent(
|
||||
eventstore.NewBaseEventForPush(ctx, LabelPolicyChangedEventType),
|
||||
eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
LabelPolicyChangedEventType),
|
||||
changes,
|
||||
)
|
||||
if err != nil {
|
||||
|
||||
@@ -2,6 +2,7 @@ package iam
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/caos/zitadel/internal/eventstore/v2"
|
||||
"github.com/caos/zitadel/internal/eventstore/v2/repository"
|
||||
"github.com/caos/zitadel/internal/v2/domain"
|
||||
@@ -19,6 +20,7 @@ type LoginPolicyAddedEvent struct {
|
||||
|
||||
func NewLoginPolicyAddedEvent(
|
||||
ctx context.Context,
|
||||
aggregate *eventstore.Aggregate,
|
||||
allowUsernamePassword,
|
||||
allowRegister,
|
||||
allowExternalIDP,
|
||||
@@ -27,7 +29,10 @@ func NewLoginPolicyAddedEvent(
|
||||
) *LoginPolicyAddedEvent {
|
||||
return &LoginPolicyAddedEvent{
|
||||
LoginPolicyAddedEvent: *policy.NewLoginPolicyAddedEvent(
|
||||
eventstore.NewBaseEventForPush(ctx, LoginPolicyAddedEventType),
|
||||
eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
LoginPolicyAddedEventType),
|
||||
allowUsernamePassword,
|
||||
allowRegister,
|
||||
allowExternalIDP,
|
||||
@@ -51,10 +56,14 @@ type LoginPolicyChangedEvent struct {
|
||||
|
||||
func NewLoginPolicyChangedEvent(
|
||||
ctx context.Context,
|
||||
aggregate *eventstore.Aggregate,
|
||||
changes []policy.LoginPolicyChanges,
|
||||
) (*LoginPolicyChangedEvent, error) {
|
||||
changedEvent, err := policy.NewLoginPolicyChangedEvent(
|
||||
eventstore.NewBaseEventForPush(ctx, LoginPolicyChangedEventType),
|
||||
eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
LoginPolicyChangedEventType),
|
||||
changes,
|
||||
)
|
||||
if err != nil {
|
||||
|
||||
@@ -2,6 +2,7 @@ package iam
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/caos/zitadel/internal/eventstore/v2"
|
||||
"github.com/caos/zitadel/internal/eventstore/v2/repository"
|
||||
"github.com/caos/zitadel/internal/v2/domain"
|
||||
@@ -22,11 +23,15 @@ type LoginPolicySecondFactorAddedEvent struct {
|
||||
|
||||
func NewLoginPolicySecondFactorAddedEvent(
|
||||
ctx context.Context,
|
||||
aggregate *eventstore.Aggregate,
|
||||
mfaType domain.SecondFactorType,
|
||||
) *LoginPolicySecondFactorAddedEvent {
|
||||
return &LoginPolicySecondFactorAddedEvent{
|
||||
SecondFactorAddedEvent: *policy.NewSecondFactorAddedEvent(
|
||||
eventstore.NewBaseEventForPush(ctx, LoginPolicySecondFactorAddedEventType),
|
||||
eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
LoginPolicySecondFactorAddedEventType),
|
||||
mfaType),
|
||||
}
|
||||
}
|
||||
@@ -48,12 +53,16 @@ type LoginPolicySecondFactorRemovedEvent struct {
|
||||
|
||||
func NewLoginPolicySecondFactorRemovedEvent(
|
||||
ctx context.Context,
|
||||
aggregate *eventstore.Aggregate,
|
||||
mfaType domain.SecondFactorType,
|
||||
) *LoginPolicySecondFactorRemovedEvent {
|
||||
|
||||
return &LoginPolicySecondFactorRemovedEvent{
|
||||
SecondFactorRemovedEvent: *policy.NewSecondFactorRemovedEvent(
|
||||
eventstore.NewBaseEventForPush(ctx, LoginPolicySecondFactorRemovedEventType),
|
||||
eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
LoginPolicySecondFactorRemovedEventType),
|
||||
mfaType),
|
||||
}
|
||||
}
|
||||
@@ -75,11 +84,15 @@ type LoginPolicyMultiFactorAddedEvent struct {
|
||||
|
||||
func NewLoginPolicyMultiFactorAddedEvent(
|
||||
ctx context.Context,
|
||||
aggregate *eventstore.Aggregate,
|
||||
mfaType domain.MultiFactorType,
|
||||
) *LoginPolicyMultiFactorAddedEvent {
|
||||
return &LoginPolicyMultiFactorAddedEvent{
|
||||
MultiFactorAddedEvent: *policy.NewMultiFactorAddedEvent(
|
||||
eventstore.NewBaseEventForPush(ctx, LoginPolicyMultiFactorAddedEventType),
|
||||
eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
LoginPolicyMultiFactorAddedEventType),
|
||||
mfaType),
|
||||
}
|
||||
}
|
||||
@@ -101,12 +114,16 @@ type LoginPolicyMultiFactorRemovedEvent struct {
|
||||
|
||||
func NewLoginPolicyMultiFactorRemovedEvent(
|
||||
ctx context.Context,
|
||||
aggregate *eventstore.Aggregate,
|
||||
mfaType domain.MultiFactorType,
|
||||
) *LoginPolicyMultiFactorRemovedEvent {
|
||||
|
||||
return &LoginPolicyMultiFactorRemovedEvent{
|
||||
MultiFactorRemovedEvent: *policy.NewMultiFactorRemovedEvent(
|
||||
eventstore.NewBaseEventForPush(ctx, LoginPolicyMultiFactorRemovedEventType),
|
||||
eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
LoginPolicyMultiFactorRemovedEventType),
|
||||
mfaType),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package iam
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/caos/zitadel/internal/eventstore/v2"
|
||||
"github.com/caos/zitadel/internal/eventstore/v2/repository"
|
||||
"github.com/caos/zitadel/internal/v2/domain"
|
||||
@@ -20,13 +21,17 @@ type IdentityProviderAddedEvent struct {
|
||||
|
||||
func NewIdentityProviderAddedEvent(
|
||||
ctx context.Context,
|
||||
aggregate *eventstore.Aggregate,
|
||||
idpConfigID string,
|
||||
idpProviderType domain.IdentityProviderType,
|
||||
) *IdentityProviderAddedEvent {
|
||||
|
||||
return &IdentityProviderAddedEvent{
|
||||
IdentityProviderAddedEvent: *policy.NewIdentityProviderAddedEvent(
|
||||
eventstore.NewBaseEventForPush(ctx, LoginPolicyIDPProviderAddedEventType),
|
||||
eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
LoginPolicyIDPProviderAddedEventType),
|
||||
idpConfigID,
|
||||
idpProviderType),
|
||||
}
|
||||
@@ -49,11 +54,15 @@ type IdentityProviderRemovedEvent struct {
|
||||
|
||||
func NewIdentityProviderRemovedEvent(
|
||||
ctx context.Context,
|
||||
aggregate *eventstore.Aggregate,
|
||||
idpConfigID string,
|
||||
) *IdentityProviderRemovedEvent {
|
||||
return &IdentityProviderRemovedEvent{
|
||||
IdentityProviderRemovedEvent: *policy.NewIdentityProviderRemovedEvent(
|
||||
eventstore.NewBaseEventForPush(ctx, LoginPolicyIDPProviderRemovedEventType),
|
||||
eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
LoginPolicyIDPProviderRemovedEventType),
|
||||
idpConfigID),
|
||||
}
|
||||
}
|
||||
@@ -75,11 +84,12 @@ type IdentityProviderCascadeRemovedEvent struct {
|
||||
|
||||
func NewIdentityProviderCascadeRemovedEvent(
|
||||
ctx context.Context,
|
||||
aggregate *eventstore.Aggregate,
|
||||
idpConfigID string,
|
||||
) *IdentityProviderCascadeRemovedEvent {
|
||||
return &IdentityProviderCascadeRemovedEvent{
|
||||
IdentityProviderCascadeRemovedEvent: *policy.NewIdentityProviderCascadeRemovedEvent(
|
||||
eventstore.NewBaseEventForPush(ctx, LoginPolicyIDPProviderCascadeRemovedEventType),
|
||||
eventstore.NewBaseEventForPush(ctx, aggregate, LoginPolicyIDPProviderCascadeRemovedEventType),
|
||||
idpConfigID),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,11 +18,12 @@ type MailTemplateAddedEvent struct {
|
||||
|
||||
func NewMailTemplateAddedEvent(
|
||||
ctx context.Context,
|
||||
aggregate *eventstore.Aggregate,
|
||||
template []byte,
|
||||
) *MailTemplateAddedEvent {
|
||||
return &MailTemplateAddedEvent{
|
||||
MailTemplateAddedEvent: *policy.NewMailTemplateAddedEvent(
|
||||
eventstore.NewBaseEventForPush(ctx, MailTemplateAddedEventType),
|
||||
eventstore.NewBaseEventForPush(ctx, aggregate, MailTemplateAddedEventType),
|
||||
template),
|
||||
}
|
||||
}
|
||||
@@ -42,10 +43,11 @@ type MailTemplateChangedEvent struct {
|
||||
|
||||
func NewMailTemplateChangedEvent(
|
||||
ctx context.Context,
|
||||
aggregate *eventstore.Aggregate,
|
||||
changes []policy.MailTemplateChanges,
|
||||
) (*MailTemplateChangedEvent, error) {
|
||||
changedEvent, err := policy.NewMailTemplateChangedEvent(
|
||||
eventstore.NewBaseEventForPush(ctx, MailTemplateChangedEventType),
|
||||
eventstore.NewBaseEventForPush(ctx, aggregate, MailTemplateChangedEventType),
|
||||
changes,
|
||||
)
|
||||
if err != nil {
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
"github.com/caos/zitadel/internal/eventstore/v2"
|
||||
"github.com/caos/zitadel/internal/eventstore/v2/repository"
|
||||
"github.com/caos/zitadel/internal/v2/domain"
|
||||
"github.com/caos/zitadel/internal/v2/repository/policy"
|
||||
)
|
||||
|
||||
@@ -19,6 +18,7 @@ type MailTextAddedEvent struct {
|
||||
|
||||
func NewMailTextAddedEvent(
|
||||
ctx context.Context,
|
||||
aggregate *eventstore.Aggregate,
|
||||
mailTextType,
|
||||
language,
|
||||
title,
|
||||
@@ -30,7 +30,7 @@ func NewMailTextAddedEvent(
|
||||
) *MailTextAddedEvent {
|
||||
return &MailTextAddedEvent{
|
||||
MailTextAddedEvent: *policy.NewMailTextAddedEvent(
|
||||
eventstore.NewBaseEventForPushWithResourceOwner(ctx, MailTextAddedEventType, domain.IAMID),
|
||||
eventstore.NewBaseEventForPush(ctx, aggregate, MailTextAddedEventType),
|
||||
mailTextType,
|
||||
language,
|
||||
title,
|
||||
@@ -57,12 +57,13 @@ type MailTextChangedEvent struct {
|
||||
|
||||
func NewMailTextChangedEvent(
|
||||
ctx context.Context,
|
||||
aggregate *eventstore.Aggregate,
|
||||
mailTextType,
|
||||
language string,
|
||||
changes []policy.MailTextChanges,
|
||||
) (*MailTextChangedEvent, error) {
|
||||
changedEvent, err := policy.NewMailTextChangedEvent(
|
||||
eventstore.NewBaseEventForPush(ctx, MailTextChangedEventType),
|
||||
eventstore.NewBaseEventForPush(ctx, aggregate, MailTextChangedEventType),
|
||||
mailTextType,
|
||||
language,
|
||||
changes,
|
||||
|
||||
@@ -19,11 +19,15 @@ type OrgIAMPolicyAddedEvent struct {
|
||||
|
||||
func NewOrgIAMPolicyAddedEvent(
|
||||
ctx context.Context,
|
||||
aggregate *eventstore.Aggregate,
|
||||
userLoginMustBeDomain bool,
|
||||
) *OrgIAMPolicyAddedEvent {
|
||||
return &OrgIAMPolicyAddedEvent{
|
||||
OrgIAMPolicyAddedEvent: *policy.NewOrgIAMPolicyAddedEvent(
|
||||
eventstore.NewBaseEventForPush(ctx, OrgIAMPolicyAddedEventType),
|
||||
eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
OrgIAMPolicyAddedEventType),
|
||||
userLoginMustBeDomain,
|
||||
),
|
||||
}
|
||||
@@ -44,10 +48,14 @@ type OrgIAMPolicyChangedEvent struct {
|
||||
|
||||
func NewOrgIAMPolicyChangedEvent(
|
||||
ctx context.Context,
|
||||
aggregate *eventstore.Aggregate,
|
||||
changes []policy.OrgIAMPolicyChanges,
|
||||
) (*OrgIAMPolicyChangedEvent, error) {
|
||||
changedEvent, err := policy.NewOrgIAMPolicyChangedEvent(
|
||||
eventstore.NewBaseEventForPush(ctx, OrgIAMPolicyChangedEventType),
|
||||
eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
OrgIAMPolicyChangedEventType),
|
||||
changes,
|
||||
)
|
||||
if err != nil {
|
||||
|
||||
@@ -19,12 +19,16 @@ type PasswordAgePolicyAddedEvent struct {
|
||||
|
||||
func NewPasswordAgePolicyAddedEvent(
|
||||
ctx context.Context,
|
||||
aggregate *eventstore.Aggregate,
|
||||
expireWarnDays,
|
||||
maxAgeDays uint64,
|
||||
) *PasswordAgePolicyAddedEvent {
|
||||
return &PasswordAgePolicyAddedEvent{
|
||||
PasswordAgePolicyAddedEvent: *policy.NewPasswordAgePolicyAddedEvent(
|
||||
eventstore.NewBaseEventForPush(ctx, PasswordAgePolicyAddedEventType),
|
||||
eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
PasswordAgePolicyAddedEventType),
|
||||
expireWarnDays,
|
||||
maxAgeDays),
|
||||
}
|
||||
@@ -45,10 +49,14 @@ type PasswordAgePolicyChangedEvent struct {
|
||||
|
||||
func NewPasswordAgePolicyChangedEvent(
|
||||
ctx context.Context,
|
||||
aggregate *eventstore.Aggregate,
|
||||
changes []policy.PasswordAgePolicyChanges,
|
||||
) (*PasswordAgePolicyChangedEvent, error) {
|
||||
changedEvent, err := policy.NewPasswordAgePolicyChangedEvent(
|
||||
eventstore.NewBaseEventForPush(ctx, PasswordAgePolicyChangedEventType),
|
||||
eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
PasswordAgePolicyChangedEventType),
|
||||
changes,
|
||||
)
|
||||
if err != nil {
|
||||
|
||||
@@ -19,6 +19,7 @@ type PasswordComplexityPolicyAddedEvent struct {
|
||||
|
||||
func NewPasswordComplexityPolicyAddedEvent(
|
||||
ctx context.Context,
|
||||
aggregate *eventstore.Aggregate,
|
||||
minLength uint64,
|
||||
hasLowercase,
|
||||
hasUppercase,
|
||||
@@ -27,7 +28,10 @@ func NewPasswordComplexityPolicyAddedEvent(
|
||||
) *PasswordComplexityPolicyAddedEvent {
|
||||
return &PasswordComplexityPolicyAddedEvent{
|
||||
PasswordComplexityPolicyAddedEvent: *policy.NewPasswordComplexityPolicyAddedEvent(
|
||||
eventstore.NewBaseEventForPush(ctx, PasswordComplexityPolicyAddedEventType),
|
||||
eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
PasswordComplexityPolicyAddedEventType),
|
||||
minLength,
|
||||
hasLowercase,
|
||||
hasUppercase,
|
||||
@@ -51,10 +55,14 @@ type PasswordComplexityPolicyChangedEvent struct {
|
||||
|
||||
func NewPasswordComplexityPolicyChangedEvent(
|
||||
ctx context.Context,
|
||||
aggregate *eventstore.Aggregate,
|
||||
changes []policy.PasswordComplexityPolicyChanges,
|
||||
) (*PasswordComplexityPolicyChangedEvent, error) {
|
||||
changedEvent, err := policy.NewPasswordComplexityPolicyChangedEvent(
|
||||
eventstore.NewBaseEventForPush(ctx, PasswordComplexityPolicyChangedEventType),
|
||||
eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
PasswordComplexityPolicyChangedEventType),
|
||||
changes,
|
||||
)
|
||||
if err != nil {
|
||||
|
||||
@@ -19,12 +19,16 @@ type PasswordLockoutPolicyAddedEvent struct {
|
||||
|
||||
func NewPasswordLockoutPolicyAddedEvent(
|
||||
ctx context.Context,
|
||||
aggregate *eventstore.Aggregate,
|
||||
maxAttempts uint64,
|
||||
showLockoutFailure bool,
|
||||
) *PasswordLockoutPolicyAddedEvent {
|
||||
return &PasswordLockoutPolicyAddedEvent{
|
||||
PasswordLockoutPolicyAddedEvent: *policy.NewPasswordLockoutPolicyAddedEvent(
|
||||
eventstore.NewBaseEventForPush(ctx, PasswordLockoutPolicyAddedEventType),
|
||||
eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
PasswordLockoutPolicyAddedEventType),
|
||||
maxAttempts,
|
||||
showLockoutFailure),
|
||||
}
|
||||
@@ -45,10 +49,14 @@ type PasswordLockoutPolicyChangedEvent struct {
|
||||
|
||||
func NewPasswordLockoutPolicyChangedEvent(
|
||||
ctx context.Context,
|
||||
aggregate *eventstore.Aggregate,
|
||||
changes []policy.PasswordLockoutPolicyChanges,
|
||||
) (*PasswordLockoutPolicyChangedEvent, error) {
|
||||
changedEvent, err := policy.NewPasswordLockoutPolicyChangedEvent(
|
||||
eventstore.NewBaseEventForPush(ctx, PasswordLockoutPolicyChangedEventType),
|
||||
eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
PasswordLockoutPolicyChangedEventType),
|
||||
changes,
|
||||
)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user