mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-28 23:18:54 +00:00
feat: Notification providers config (#3212)
* feat: add login check lifetimes to login policy * feat: org features test * feat: debug notificatiaon events * feat: debug notification file/log commands * feat: add requests to proto * feat: add api for debug notification providers file/log * feat: add projection for debug notifiication providers * feat: requests * feat: merge v2 * feat: add settings proto to generate * feat: notifiaction providers * fix: remove unused code * Update iam_converter.go Co-authored-by: Livio Amstutz <[email protected]>
This commit is contained in:
@@ -0,0 +1,108 @@
|
||||
package iam
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/caos/zitadel/internal/eventstore"
|
||||
"github.com/caos/zitadel/internal/repository/settings"
|
||||
|
||||
"github.com/caos/zitadel/internal/eventstore/repository"
|
||||
)
|
||||
|
||||
const (
|
||||
logType = ".log"
|
||||
)
|
||||
|
||||
var (
|
||||
DebugNotificationProviderLogAddedEventType = iamEventTypePrefix + settings.DebugNotificationPrefix + logType + settings.DebugNotificationProviderAdded
|
||||
DebugNotificationProviderLogChangedEventType = iamEventTypePrefix + settings.DebugNotificationPrefix + logType + settings.DebugNotificationProviderChanged
|
||||
DebugNotificationProviderLogEnabledEventType = iamEventTypePrefix + settings.DebugNotificationPrefix + logType + settings.DebugNotificationProviderEnabled
|
||||
DebugNotificationProviderLogDisabledEventType = iamEventTypePrefix + settings.DebugNotificationPrefix + logType + settings.DebugNotificationProviderDisabled
|
||||
DebugNotificationProviderLogRemovedEventType = iamEventTypePrefix + settings.DebugNotificationPrefix + logType + settings.DebugNotificationProviderRemoved
|
||||
)
|
||||
|
||||
type DebugNotificationProviderLogAddedEvent struct {
|
||||
settings.DebugNotificationProviderAddedEvent
|
||||
}
|
||||
|
||||
func NewDebugNotificationProviderLogAddedEvent(
|
||||
ctx context.Context,
|
||||
aggregate *eventstore.Aggregate,
|
||||
compact bool,
|
||||
) *DebugNotificationProviderLogAddedEvent {
|
||||
return &DebugNotificationProviderLogAddedEvent{
|
||||
DebugNotificationProviderAddedEvent: *settings.NewDebugNotificationProviderAddedEvent(
|
||||
eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
DebugNotificationProviderLogAddedEventType),
|
||||
compact),
|
||||
}
|
||||
}
|
||||
|
||||
func DebugNotificationProviderLogAddedEventMapper(event *repository.Event) (eventstore.Event, error) {
|
||||
e, err := settings.DebugNotificationProviderAddedEventMapper(event)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &DebugNotificationProviderLogAddedEvent{DebugNotificationProviderAddedEvent: *e.(*settings.DebugNotificationProviderAddedEvent)}, nil
|
||||
}
|
||||
|
||||
type DebugNotificationProviderLogChangedEvent struct {
|
||||
settings.DebugNotificationProviderChangedEvent
|
||||
}
|
||||
|
||||
func NewDebugNotificationProviderLogChangedEvent(
|
||||
ctx context.Context,
|
||||
aggregate *eventstore.Aggregate,
|
||||
changes []settings.DebugNotificationProviderChanges,
|
||||
) (*DebugNotificationProviderLogChangedEvent, error) {
|
||||
changedEvent, err := settings.NewDebugNotificationProviderChangedEvent(
|
||||
eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
DebugNotificationProviderLogChangedEventType),
|
||||
changes,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &DebugNotificationProviderLogChangedEvent{DebugNotificationProviderChangedEvent: *changedEvent}, nil
|
||||
}
|
||||
|
||||
func DebugNotificationProviderLogChangedEventMapper(event *repository.Event) (eventstore.Event, error) {
|
||||
e, err := settings.DebugNotificationProviderChangedEventMapper(event)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &DebugNotificationProviderLogChangedEvent{DebugNotificationProviderChangedEvent: *e.(*settings.DebugNotificationProviderChangedEvent)}, nil
|
||||
}
|
||||
|
||||
type DebugNotificationProviderLogRemovedEvent struct {
|
||||
settings.DebugNotificationProviderRemovedEvent
|
||||
}
|
||||
|
||||
func NewDebugNotificationProviderLogRemovedEvent(
|
||||
ctx context.Context,
|
||||
aggregate *eventstore.Aggregate,
|
||||
) *DebugNotificationProviderLogRemovedEvent {
|
||||
return &DebugNotificationProviderLogRemovedEvent{
|
||||
DebugNotificationProviderRemovedEvent: *settings.NewDebugNotificationProviderRemovedEvent(
|
||||
eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
DebugNotificationProviderLogRemovedEventType),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
func DebugNotificationProviderLogRemovedEventMapper(event *repository.Event) (eventstore.Event, error) {
|
||||
e, err := settings.DebugNotificationProviderRemovedEventMapper(event)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &DebugNotificationProviderLogRemovedEvent{DebugNotificationProviderRemovedEvent: *e.(*settings.DebugNotificationProviderRemovedEvent)}, nil
|
||||
}
|
||||
Reference in New Issue
Block a user