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