mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-02 19:22:25 +00:00
This implementation increases parallel write capabilities of the eventstore. Please have a look at the technical advisories: [05](https://zitadel.com/docs/support/advisory/a10005) and [06](https://zitadel.com/docs/support/advisory/a10006). The implementation of eventstore.push is rewritten and stored events are migrated to a new table `eventstore.events2`. If you are using cockroach: make sure that the database user of ZITADEL has `VIEWACTIVITY` grant. This is used to query events.
106 lines
2.9 KiB
Go
106 lines
2.9 KiB
Go
package org
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/zitadel/zitadel/internal/domain"
|
|
"github.com/zitadel/zitadel/internal/eventstore"
|
|
"github.com/zitadel/zitadel/internal/repository/policy"
|
|
)
|
|
|
|
var (
|
|
LoginPolicyIDPProviderAddedEventType = orgEventTypePrefix + policy.LoginPolicyIDPProviderAddedType
|
|
LoginPolicyIDPProviderRemovedEventType = orgEventTypePrefix + policy.LoginPolicyIDPProviderRemovedType
|
|
LoginPolicyIDPProviderCascadeRemovedEventType = orgEventTypePrefix + policy.LoginPolicyIDPProviderCascadeRemovedType
|
|
)
|
|
|
|
type IdentityProviderAddedEvent struct {
|
|
policy.IdentityProviderAddedEvent
|
|
}
|
|
|
|
func NewIdentityProviderAddedEvent(
|
|
ctx context.Context,
|
|
aggregate *eventstore.Aggregate,
|
|
idpConfigID string,
|
|
idpProviderType domain.IdentityProviderType,
|
|
) *IdentityProviderAddedEvent {
|
|
|
|
return &IdentityProviderAddedEvent{
|
|
IdentityProviderAddedEvent: *policy.NewIdentityProviderAddedEvent(
|
|
eventstore.NewBaseEventForPush(
|
|
ctx,
|
|
aggregate,
|
|
LoginPolicyIDPProviderAddedEventType),
|
|
idpConfigID,
|
|
idpProviderType),
|
|
}
|
|
}
|
|
|
|
func IdentityProviderAddedEventMapper(event eventstore.Event) (eventstore.Event, error) {
|
|
e, err := policy.IdentityProviderAddedEventMapper(event)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &IdentityProviderAddedEvent{
|
|
IdentityProviderAddedEvent: *e.(*policy.IdentityProviderAddedEvent),
|
|
}, nil
|
|
}
|
|
|
|
type IdentityProviderRemovedEvent struct {
|
|
policy.IdentityProviderRemovedEvent
|
|
}
|
|
|
|
func NewIdentityProviderRemovedEvent(
|
|
ctx context.Context,
|
|
aggregate *eventstore.Aggregate,
|
|
idpConfigID string,
|
|
) *IdentityProviderRemovedEvent {
|
|
return &IdentityProviderRemovedEvent{
|
|
IdentityProviderRemovedEvent: *policy.NewIdentityProviderRemovedEvent(
|
|
eventstore.NewBaseEventForPush(
|
|
ctx,
|
|
aggregate,
|
|
LoginPolicyIDPProviderRemovedEventType),
|
|
idpConfigID),
|
|
}
|
|
}
|
|
|
|
func IdentityProviderRemovedEventMapper(event eventstore.Event) (eventstore.Event, error) {
|
|
e, err := policy.IdentityProviderRemovedEventMapper(event)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &IdentityProviderRemovedEvent{
|
|
IdentityProviderRemovedEvent: *e.(*policy.IdentityProviderRemovedEvent),
|
|
}, nil
|
|
}
|
|
|
|
type IdentityProviderCascadeRemovedEvent struct {
|
|
policy.IdentityProviderCascadeRemovedEvent
|
|
}
|
|
|
|
func NewIdentityProviderCascadeRemovedEvent(
|
|
ctx context.Context,
|
|
aggregate *eventstore.Aggregate,
|
|
idpConfigID string,
|
|
) *IdentityProviderCascadeRemovedEvent {
|
|
return &IdentityProviderCascadeRemovedEvent{
|
|
IdentityProviderCascadeRemovedEvent: *policy.NewIdentityProviderCascadeRemovedEvent(
|
|
eventstore.NewBaseEventForPush(ctx, aggregate, LoginPolicyIDPProviderRemovedEventType),
|
|
idpConfigID),
|
|
}
|
|
}
|
|
|
|
func IdentityProviderCascadeRemovedEventMapper(event eventstore.Event) (eventstore.Event, error) {
|
|
e, err := policy.IdentityProviderCascadeRemovedEventMapper(event)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &IdentityProviderCascadeRemovedEvent{
|
|
IdentityProviderCascadeRemovedEvent: *e.(*policy.IdentityProviderCascadeRemovedEvent),
|
|
}, nil
|
|
}
|