mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-14 11:58:02 +00:00
38 lines
1.1 KiB
Go
38 lines
1.1 KiB
Go
package iam
|
|
|
|
import (
|
|
"github.com/caos/zitadel/internal/eventstore/v2"
|
|
"github.com/caos/zitadel/internal/v2/repository/policy"
|
|
)
|
|
|
|
var (
|
|
PasswordAgePolicyAddedEventType = iamEventTypePrefix + policy.PasswordAgePolicyAddedEventType
|
|
PasswordAgePolicyChangedEventType = iamEventTypePrefix + policy.PasswordAgePolicyChangedEventType
|
|
)
|
|
|
|
type PasswordAgePolicyReadModel struct {
|
|
policy.PasswordAgePolicyReadModel
|
|
}
|
|
|
|
func (rm *PasswordAgePolicyReadModel) AppendEvents(events ...eventstore.EventReader) (err error) {
|
|
for _, event := range events {
|
|
switch e := event.(type) {
|
|
case *PasswordAgePolicyAddedEvent:
|
|
rm.ReadModel.AppendEvents(&e.PasswordAgePolicyAddedEvent)
|
|
case *PasswordAgePolicyChangedEvent:
|
|
rm.ReadModel.AppendEvents(&e.PasswordAgePolicyChangedEvent)
|
|
case *policy.PasswordAgePolicyAddedEvent, *policy.PasswordAgePolicyChangedEvent:
|
|
rm.ReadModel.AppendEvents(e)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
type PasswordAgePolicyAddedEvent struct {
|
|
policy.PasswordAgePolicyAddedEvent
|
|
}
|
|
|
|
type PasswordAgePolicyChangedEvent struct {
|
|
policy.PasswordAgePolicyChangedEvent
|
|
}
|