mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-15 12:27:59 +00:00
b5564572bc
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.
75 lines
2.0 KiB
Go
75 lines
2.0 KiB
Go
package instance
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/zitadel/zitadel/internal/eventstore"
|
|
"github.com/zitadel/zitadel/internal/repository/policy"
|
|
)
|
|
|
|
var (
|
|
PasswordAgePolicyAddedEventType = instanceEventTypePrefix + policy.PasswordAgePolicyAddedEventType
|
|
PasswordAgePolicyChangedEventType = instanceEventTypePrefix + policy.PasswordAgePolicyChangedEventType
|
|
)
|
|
|
|
type PasswordAgePolicyAddedEvent struct {
|
|
policy.PasswordAgePolicyAddedEvent
|
|
}
|
|
|
|
func NewPasswordAgePolicyAddedEvent(
|
|
ctx context.Context,
|
|
aggregate *eventstore.Aggregate,
|
|
expireWarnDays,
|
|
maxAgeDays uint64,
|
|
) *PasswordAgePolicyAddedEvent {
|
|
return &PasswordAgePolicyAddedEvent{
|
|
PasswordAgePolicyAddedEvent: *policy.NewPasswordAgePolicyAddedEvent(
|
|
eventstore.NewBaseEventForPush(
|
|
ctx,
|
|
aggregate,
|
|
PasswordAgePolicyAddedEventType),
|
|
expireWarnDays,
|
|
maxAgeDays),
|
|
}
|
|
}
|
|
|
|
func PasswordAgePolicyAddedEventMapper(event eventstore.Event) (eventstore.Event, error) {
|
|
e, err := policy.PasswordAgePolicyAddedEventMapper(event)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &PasswordAgePolicyAddedEvent{PasswordAgePolicyAddedEvent: *e.(*policy.PasswordAgePolicyAddedEvent)}, nil
|
|
}
|
|
|
|
type PasswordAgePolicyChangedEvent struct {
|
|
policy.PasswordAgePolicyChangedEvent
|
|
}
|
|
|
|
func NewPasswordAgePolicyChangedEvent(
|
|
ctx context.Context,
|
|
aggregate *eventstore.Aggregate,
|
|
changes []policy.PasswordAgePolicyChanges,
|
|
) (*PasswordAgePolicyChangedEvent, error) {
|
|
changedEvent, err := policy.NewPasswordAgePolicyChangedEvent(
|
|
eventstore.NewBaseEventForPush(
|
|
ctx,
|
|
aggregate,
|
|
PasswordAgePolicyChangedEventType),
|
|
changes,
|
|
)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &PasswordAgePolicyChangedEvent{PasswordAgePolicyChangedEvent: *changedEvent}, nil
|
|
}
|
|
|
|
func PasswordAgePolicyChangedEventMapper(event eventstore.Event) (eventstore.Event, error) {
|
|
e, err := policy.PasswordAgePolicyChangedEventMapper(event)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &PasswordAgePolicyChangedEvent{PasswordAgePolicyChangedEvent: *e.(*policy.PasswordAgePolicyChangedEvent)}, nil
|
|
}
|