mirror of
https://github.com/zitadel/zitadel.git
synced 2025-03-04 11:15:24 +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
|
||
|
}
|