mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-27 22:48:52 +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:
@@ -49,10 +49,11 @@ func (e *DomainAddedEvent) UniqueConstraints() []*eventstore.EventUniqueConstrai
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewDomainAddedEvent(ctx context.Context, domain string) *DomainAddedEvent {
|
||||
func NewDomainAddedEvent(ctx context.Context, aggregate *eventstore.Aggregate, domain string) *DomainAddedEvent {
|
||||
return &DomainAddedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
OrgDomainAddedEventType,
|
||||
),
|
||||
Domain: domain,
|
||||
@@ -89,12 +90,14 @@ func (e *DomainVerificationAddedEvent) UniqueConstraints() []*eventstore.EventUn
|
||||
|
||||
func NewDomainVerificationAddedEvent(
|
||||
ctx context.Context,
|
||||
aggregate *eventstore.Aggregate,
|
||||
domain string,
|
||||
validationType domain.OrgDomainValidationType,
|
||||
validationCode *crypto.CryptoValue) *DomainVerificationAddedEvent {
|
||||
return &DomainVerificationAddedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
OrgDomainVerificationAddedEventType,
|
||||
),
|
||||
Domain: domain,
|
||||
@@ -129,10 +132,11 @@ func (e *DomainVerificationFailedEvent) UniqueConstraints() []*eventstore.EventU
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewDomainVerificationFailedEvent(ctx context.Context, domain string) *DomainVerificationFailedEvent {
|
||||
func NewDomainVerificationFailedEvent(ctx context.Context, aggregate *eventstore.Aggregate, domain string) *DomainVerificationFailedEvent {
|
||||
return &DomainVerificationFailedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
OrgDomainVerificationFailedEventType,
|
||||
),
|
||||
Domain: domain,
|
||||
@@ -165,10 +169,11 @@ func (e *DomainVerifiedEvent) UniqueConstraints() []*eventstore.EventUniqueConst
|
||||
return []*eventstore.EventUniqueConstraint{NewAddOrgDomainUniqueConstraint(e.Domain)}
|
||||
}
|
||||
|
||||
func NewDomainVerifiedEvent(ctx context.Context, domain string) *DomainVerifiedEvent {
|
||||
func NewDomainVerifiedEvent(ctx context.Context, aggregate *eventstore.Aggregate, domain string) *DomainVerifiedEvent {
|
||||
return &DomainVerifiedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
OrgDomainVerifiedEventType,
|
||||
),
|
||||
Domain: domain,
|
||||
@@ -201,10 +206,11 @@ func (e *DomainPrimarySetEvent) UniqueConstraints() []*eventstore.EventUniqueCon
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewDomainPrimarySetEvent(ctx context.Context, domain string) *DomainPrimarySetEvent {
|
||||
func NewDomainPrimarySetEvent(ctx context.Context, aggregate *eventstore.Aggregate, domain string) *DomainPrimarySetEvent {
|
||||
return &DomainPrimarySetEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
OrgDomainPrimarySetEventType,
|
||||
),
|
||||
Domain: domain,
|
||||
@@ -241,10 +247,11 @@ func (e *DomainRemovedEvent) UniqueConstraints() []*eventstore.EventUniqueConstr
|
||||
return []*eventstore.EventUniqueConstraint{NewRemoveOrgDomainUniqueConstraint(e.Domain)}
|
||||
}
|
||||
|
||||
func NewDomainRemovedEvent(ctx context.Context, domain string) *DomainRemovedEvent {
|
||||
func NewDomainRemovedEvent(ctx context.Context, aggregate *eventstore.Aggregate, domain string) *DomainRemovedEvent {
|
||||
return &DomainRemovedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
OrgDomainRemovedEventType,
|
||||
),
|
||||
Domain: domain,
|
||||
|
||||
@@ -2,6 +2,7 @@ package org
|
||||
|
||||
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,7 +23,7 @@ type IDPConfigAddedEvent struct {
|
||||
|
||||
func NewIDPConfigAddedEvent(
|
||||
ctx context.Context,
|
||||
resourceOwner,
|
||||
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,
|
||||
resourceOwner,
|
||||
),
|
||||
configID,
|
||||
name,
|
||||
@@ -59,13 +60,15 @@ 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,17 +94,17 @@ 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,
|
||||
@@ -124,6 +127,7 @@ type IDPConfigDeactivatedEvent struct {
|
||||
|
||||
func NewIDPConfigDeactivatedEvent(
|
||||
ctx context.Context,
|
||||
aggregate *eventstore.Aggregate,
|
||||
configID string,
|
||||
) *IDPConfigDeactivatedEvent {
|
||||
|
||||
@@ -131,6 +135,7 @@ func NewIDPConfigDeactivatedEvent(
|
||||
IDPConfigDeactivatedEvent: *idpconfig.NewIDPConfigDeactivatedEvent(
|
||||
eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
IDPConfigDeactivatedEventType,
|
||||
),
|
||||
configID,
|
||||
@@ -153,6 +158,7 @@ type IDPConfigReactivatedEvent struct {
|
||||
|
||||
func NewIDPConfigReactivatedEvent(
|
||||
ctx context.Context,
|
||||
aggregate *eventstore.Aggregate,
|
||||
configID string,
|
||||
) *IDPConfigReactivatedEvent {
|
||||
|
||||
@@ -160,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 org
|
||||
|
||||
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 {
|
||||
@@ -27,9 +28,9 @@ func NewMemberAddedEvent(
|
||||
MemberAddedEvent: *member.NewMemberAddedEvent(
|
||||
eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
MemberAddedEventType,
|
||||
),
|
||||
aggregateID,
|
||||
userID,
|
||||
roles...,
|
||||
),
|
||||
@@ -51,6 +52,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,
|
||||
),
|
||||
}
|
||||
|
||||
@@ -45,10 +45,11 @@ func (e *OrgAddedEvent) UniqueConstraints() []*eventstore.EventUniqueConstraint
|
||||
return []*eventstore.EventUniqueConstraint{NewAddOrgNameUniqueConstraint(e.Name)}
|
||||
}
|
||||
|
||||
func NewOrgAddedEvent(ctx context.Context, name string) *OrgAddedEvent {
|
||||
func NewOrgAddedEvent(ctx context.Context, aggregate *eventstore.Aggregate, name string) *OrgAddedEvent {
|
||||
return &OrgAddedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
OrgAddedEventType,
|
||||
),
|
||||
Name: name,
|
||||
@@ -80,15 +81,16 @@ func (e *OrgChangedEvent) Data() interface{} {
|
||||
|
||||
func (e *OrgChangedEvent) UniqueConstraints() []*eventstore.EventUniqueConstraint {
|
||||
return []*eventstore.EventUniqueConstraint{
|
||||
NewRemoveOrgDomainUniqueConstraint(e.oldName),
|
||||
NewRemoveOrgNameUniqueConstraint(e.oldName),
|
||||
NewAddOrgNameUniqueConstraint(e.Name),
|
||||
}
|
||||
}
|
||||
|
||||
func NewOrgChangedEvent(ctx context.Context, oldName, newName string) *OrgChangedEvent {
|
||||
func NewOrgChangedEvent(ctx context.Context, aggregate *eventstore.Aggregate, oldName, newName string) *OrgChangedEvent {
|
||||
return &OrgChangedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
OrgChangedEventType,
|
||||
),
|
||||
Name: newName,
|
||||
@@ -120,10 +122,11 @@ func (e *OrgDeactivatedEvent) UniqueConstraints() []*eventstore.EventUniqueConst
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewOrgDeactivatedEvent(ctx context.Context) *OrgDeactivatedEvent {
|
||||
func NewOrgDeactivatedEvent(ctx context.Context, aggregate *eventstore.Aggregate) *OrgDeactivatedEvent {
|
||||
return &OrgDeactivatedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
OrgDeactivatedEventType,
|
||||
),
|
||||
}
|
||||
@@ -153,10 +156,11 @@ func (e *OrgReactivatedEvent) UniqueConstraints() []*eventstore.EventUniqueConst
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewOrgReactivatedEvent(ctx context.Context) *OrgReactivatedEvent {
|
||||
func NewOrgReactivatedEvent(ctx context.Context, aggregate *eventstore.Aggregate) *OrgReactivatedEvent {
|
||||
return &OrgReactivatedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
OrgReactivatedEventType,
|
||||
),
|
||||
}
|
||||
@@ -187,10 +191,11 @@ func (e *OrgRemovedEvent) UniqueConstraints() []*eventstore.EventUniqueConstrain
|
||||
return []*eventstore.EventUniqueConstraint{NewRemoveOrgNameUniqueConstraint(e.name)}
|
||||
}
|
||||
|
||||
func NewOrgRemovedEvent(ctx context.Context, name string) *OrgRemovedEvent {
|
||||
func NewOrgRemovedEvent(ctx context.Context, aggregate *eventstore.Aggregate, name string) *OrgRemovedEvent {
|
||||
return &OrgRemovedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
OrgRemovedEventType,
|
||||
),
|
||||
name: name,
|
||||
|
||||
@@ -20,12 +20,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),
|
||||
}
|
||||
@@ -46,10 +50,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 {
|
||||
@@ -73,10 +81,14 @@ type LabelPolicyRemovedEvent struct {
|
||||
|
||||
func NewLabelPolicyRemovedEvent(
|
||||
ctx context.Context,
|
||||
aggregate *eventstore.Aggregate,
|
||||
) *LabelPolicyRemovedEvent {
|
||||
return &LabelPolicyRemovedEvent{
|
||||
LabelPolicyRemovedEvent: *policy.NewLabelPolicyRemovedEvent(
|
||||
eventstore.NewBaseEventForPush(ctx, LabelPolicyRemovedEventType),
|
||||
eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
LabelPolicyRemovedEventType),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ type LoginPolicyAddedEvent struct {
|
||||
|
||||
func NewLoginPolicyAddedEvent(
|
||||
ctx context.Context,
|
||||
aggregate *eventstore.Aggregate,
|
||||
allowUsernamePassword,
|
||||
allowRegister,
|
||||
allowExternalIDP,
|
||||
@@ -29,7 +30,10 @@ func NewLoginPolicyAddedEvent(
|
||||
) *LoginPolicyAddedEvent {
|
||||
return &LoginPolicyAddedEvent{
|
||||
LoginPolicyAddedEvent: *policy.NewLoginPolicyAddedEvent(
|
||||
eventstore.NewBaseEventForPush(ctx, LoginPolicyAddedEventType),
|
||||
eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
LoginPolicyAddedEventType),
|
||||
allowUsernamePassword,
|
||||
allowRegister,
|
||||
allowExternalIDP,
|
||||
@@ -53,10 +57,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 {
|
||||
@@ -80,10 +88,14 @@ type LoginPolicyRemovedEvent struct {
|
||||
|
||||
func NewLoginPolicyRemovedEvent(
|
||||
ctx context.Context,
|
||||
aggregate *eventstore.Aggregate,
|
||||
) *LoginPolicyRemovedEvent {
|
||||
return &LoginPolicyRemovedEvent{
|
||||
LoginPolicyRemovedEvent: *policy.NewLoginPolicyRemovedEvent(
|
||||
eventstore.NewBaseEventForPush(ctx, LoginPolicyRemovedEventType),
|
||||
eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
LoginPolicyRemovedEventType),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package org
|
||||
|
||||
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 org
|
||||
|
||||
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, LoginPolicyIDPProviderRemovedEventType),
|
||||
eventstore.NewBaseEventForPush(ctx, aggregate, LoginPolicyIDPProviderRemovedEventType),
|
||||
idpConfigID),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,11 +20,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),
|
||||
}
|
||||
}
|
||||
@@ -44,10 +45,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 {
|
||||
@@ -71,10 +73,11 @@ type MailTemplateRemovedEvent struct {
|
||||
|
||||
func NewMailTemplateRemovedEvent(
|
||||
ctx context.Context,
|
||||
aggregate *eventstore.Aggregate,
|
||||
) *MailTemplateRemovedEvent {
|
||||
return &MailTemplateRemovedEvent{
|
||||
MailTemplateRemovedEvent: *policy.NewMailTemplateRemovedEvent(
|
||||
eventstore.NewBaseEventForPush(ctx, MailTemplateRemovedEventType),
|
||||
eventstore.NewBaseEventForPush(ctx, aggregate, MailTemplateRemovedEventType),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ type MailTextAddedEvent struct {
|
||||
|
||||
func NewMailTextAddedEvent(
|
||||
ctx context.Context,
|
||||
resourceOwner,
|
||||
aggregate *eventstore.Aggregate,
|
||||
mailTextType,
|
||||
language,
|
||||
title,
|
||||
@@ -32,7 +32,7 @@ func NewMailTextAddedEvent(
|
||||
) *MailTextAddedEvent {
|
||||
return &MailTextAddedEvent{
|
||||
MailTextAddedEvent: *policy.NewMailTextAddedEvent(
|
||||
eventstore.NewBaseEventForPushWithResourceOwner(ctx, MailTextAddedEventType, resourceOwner),
|
||||
eventstore.NewBaseEventForPush(ctx, aggregate, MailTextAddedEventType),
|
||||
mailTextType,
|
||||
language,
|
||||
title,
|
||||
@@ -59,12 +59,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,
|
||||
@@ -90,13 +91,13 @@ type MailTextRemovedEvent struct {
|
||||
|
||||
func NewMailTextRemovedEvent(
|
||||
ctx context.Context,
|
||||
resourceOwner,
|
||||
aggregate *eventstore.Aggregate,
|
||||
mailTextType,
|
||||
language string,
|
||||
) *MailTextRemovedEvent {
|
||||
return &MailTextRemovedEvent{
|
||||
MailTextRemovedEvent: *policy.NewMailTextRemovedEvent(
|
||||
eventstore.NewBaseEventForPushWithResourceOwner(ctx, MailTextRemovedEventType, resourceOwner),
|
||||
eventstore.NewBaseEventForPush(ctx, aggregate, MailTextRemovedEventType),
|
||||
mailTextType,
|
||||
language,
|
||||
),
|
||||
|
||||
@@ -2,6 +2,7 @@ package org
|
||||
|
||||
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"
|
||||
@@ -22,11 +23,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,
|
||||
),
|
||||
}
|
||||
@@ -47,10 +52,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 {
|
||||
@@ -74,10 +83,14 @@ type OrgIAMPolicyRemovedEvent struct {
|
||||
|
||||
func NewOrgIAMPolicyRemovedEvent(
|
||||
ctx context.Context,
|
||||
aggregate *eventstore.Aggregate,
|
||||
) *OrgIAMPolicyRemovedEvent {
|
||||
return &OrgIAMPolicyRemovedEvent{
|
||||
OrgIAMPolicyRemovedEvent: *policy.NewOrgIAMPolicyRemovedEvent(
|
||||
eventstore.NewBaseEventForPush(ctx, OrgIAMPolicyRemovedEventType),
|
||||
eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
OrgIAMPolicyRemovedEventType),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,12 +20,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),
|
||||
}
|
||||
@@ -46,10 +50,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 {
|
||||
@@ -73,10 +81,14 @@ type PasswordAgePolicyRemovedEvent struct {
|
||||
|
||||
func NewPasswordAgePolicyRemovedEvent(
|
||||
ctx context.Context,
|
||||
aggregate *eventstore.Aggregate,
|
||||
) *PasswordAgePolicyRemovedEvent {
|
||||
return &PasswordAgePolicyRemovedEvent{
|
||||
PasswordAgePolicyRemovedEvent: *policy.NewPasswordAgePolicyRemovedEvent(
|
||||
eventstore.NewBaseEventForPush(ctx, PasswordAgePolicyRemovedEventType),
|
||||
eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
PasswordAgePolicyRemovedEventType),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package org
|
||||
|
||||
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"
|
||||
@@ -19,6 +20,7 @@ type PasswordComplexityPolicyAddedEvent struct {
|
||||
|
||||
func NewPasswordComplexityPolicyAddedEvent(
|
||||
ctx context.Context,
|
||||
aggregate *eventstore.Aggregate,
|
||||
minLength uint64,
|
||||
hasLowercase,
|
||||
hasUppercase,
|
||||
@@ -27,7 +29,10 @@ func NewPasswordComplexityPolicyAddedEvent(
|
||||
) *PasswordComplexityPolicyAddedEvent {
|
||||
return &PasswordComplexityPolicyAddedEvent{
|
||||
PasswordComplexityPolicyAddedEvent: *policy.NewPasswordComplexityPolicyAddedEvent(
|
||||
eventstore.NewBaseEventForPush(ctx, PasswordComplexityPolicyAddedEventType),
|
||||
eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
PasswordComplexityPolicyAddedEventType),
|
||||
minLength,
|
||||
hasLowercase,
|
||||
hasUppercase,
|
||||
@@ -51,10 +56,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 {
|
||||
@@ -78,10 +87,14 @@ type PasswordComplexityPolicyRemovedEvent struct {
|
||||
|
||||
func NewPasswordComplexityPolicyRemovedEvent(
|
||||
ctx context.Context,
|
||||
aggregate *eventstore.Aggregate,
|
||||
) *PasswordComplexityPolicyRemovedEvent {
|
||||
return &PasswordComplexityPolicyRemovedEvent{
|
||||
PasswordComplexityPolicyRemovedEvent: *policy.NewPasswordComplexityPolicyRemovedEvent(
|
||||
eventstore.NewBaseEventForPush(ctx, PasswordComplexityPolicyRemovedEventType),
|
||||
eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
PasswordComplexityPolicyRemovedEventType),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,12 +20,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),
|
||||
}
|
||||
@@ -46,10 +50,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 {
|
||||
@@ -73,10 +81,14 @@ type PasswordLockoutPolicyRemovedEvent struct {
|
||||
|
||||
func NewPasswordLockoutPolicyRemovedEvent(
|
||||
ctx context.Context,
|
||||
aggregate *eventstore.Aggregate,
|
||||
) *PasswordLockoutPolicyRemovedEvent {
|
||||
return &PasswordLockoutPolicyRemovedEvent{
|
||||
PasswordLockoutPolicyRemovedEvent: *policy.NewPasswordLockoutPolicyRemovedEvent(
|
||||
eventstore.NewBaseEventForPush(ctx, PasswordLockoutPolicyRemovedEventType),
|
||||
eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
PasswordLockoutPolicyRemovedEventType),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user