mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-14 03:54:21 +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 (
|
||
|
PasswordLockoutPolicyAddedEventType = iamEventTypePrefix + policy.PasswordLockoutPolicyAddedEventType
|
||
|
PasswordLockoutPolicyChangedEventType = iamEventTypePrefix + policy.PasswordLockoutPolicyChangedEventType
|
||
|
)
|
||
|
|
||
|
type PasswordLockoutPolicyReadModel struct {
|
||
|
policy.PasswordLockoutPolicyReadModel
|
||
|
}
|
||
|
|
||
|
func (rm *PasswordLockoutPolicyReadModel) AppendEvents(events ...eventstore.EventReader) (err error) {
|
||
|
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)
|
||
|
}
|
||
|
}
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
type PasswordLockoutPolicyAddedEvent struct {
|
||
|
policy.PasswordLockoutPolicyAddedEvent
|
||
|
}
|
||
|
|
||
|
type PasswordLockoutPolicyChangedEvent struct {
|
||
|
policy.PasswordLockoutPolicyChangedEvent
|
||
|
}
|