mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-26 22:38:45 +00:00
New eventstore policies (#1084)
* feat: login policy * feat: password complexity policy * feat: org iam policy * feat: label policy * feat: add and change policies * feat: second factors * feat: second and multi factors * feat: better naming * feat: better naming
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
package label
|
||||
|
||||
import "github.com/caos/zitadel/internal/eventstore/v2"
|
||||
|
||||
type ReadModel struct {
|
||||
eventstore.ReadModel
|
||||
|
||||
PrimaryColor string
|
||||
SecondaryColor string
|
||||
}
|
||||
|
||||
func (rm *ReadModel) Reduce() error {
|
||||
for _, event := range rm.Events {
|
||||
switch e := event.(type) {
|
||||
case *AddedEvent:
|
||||
rm.PrimaryColor = e.PrimaryColor
|
||||
rm.SecondaryColor = e.SecondaryColor
|
||||
case *ChangedEvent:
|
||||
rm.PrimaryColor = e.PrimaryColor
|
||||
rm.SecondaryColor = e.SecondaryColor
|
||||
}
|
||||
}
|
||||
return rm.ReadModel.Reduce()
|
||||
}
|
||||
Reference in New Issue
Block a user