2020-11-12 21:50:01 +00:00
|
|
|
package iam
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/caos/zitadel/internal/eventstore/v2"
|
|
|
|
"github.com/caos/zitadel/internal/v2/repository/policy"
|
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
|
|
|
PasswordLockoutPolicyAddedEventType = iamEventTypePrefix + policy.PasswordLockoutPolicyAddedEventType
|
|
|
|
PasswordLockoutPolicyChangedEventType = iamEventTypePrefix + policy.PasswordLockoutPolicyChangedEventType
|
|
|
|
)
|
|
|
|
|
|
|
|
type PasswordLockoutPolicyReadModel struct {
|
|
|
|
policy.PasswordLockoutPolicyReadModel
|
|
|
|
}
|
|
|
|
|
2020-11-25 13:12:44 +00:00
|
|
|
func (rm *PasswordLockoutPolicyReadModel) AppendEvents(events ...eventstore.EventReader) {
|
2020-11-12 21:50:01 +00:00
|
|
|
for _, event := range events {
|
|
|
|
switch e := event.(type) {
|
|
|
|
case *PasswordLockoutPolicyAddedEvent:
|
|
|
|
rm.ReadModel.AppendEvents(&e.PasswordLockoutPolicyAddedEvent)
|
|
|
|
case *PasswordLockoutPolicyChangedEvent:
|
|
|
|
rm.ReadModel.AppendEvents(&e.PasswordLockoutPolicyChangedEvent)
|
|
|
|
case *policy.PasswordLockoutPolicyAddedEvent, *policy.PasswordLockoutPolicyChangedEvent:
|
|
|
|
rm.ReadModel.AppendEvents(e)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
type PasswordLockoutPolicyAddedEvent struct {
|
|
|
|
policy.PasswordLockoutPolicyAddedEvent
|
|
|
|
}
|
|
|
|
|
|
|
|
type PasswordLockoutPolicyChangedEvent struct {
|
|
|
|
policy.PasswordLockoutPolicyChangedEvent
|
|
|
|
}
|