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:
Fabi
2020-12-11 15:49:19 +01:00
committed by GitHub
parent 31ea9d1acd
commit 5b433dcaa3
85 changed files with 3477 additions and 1648 deletions
@@ -0,0 +1,26 @@
package label
import (
"github.com/caos/zitadel/internal/eventstore/v2"
)
type WriteModel struct {
eventstore.WriteModel
PrimaryColor string
SecondaryColor string
}
func (wm *WriteModel) Reduce() error {
for _, event := range wm.Events {
switch e := event.(type) {
case *AddedEvent:
wm.PrimaryColor = e.PrimaryColor
wm.SecondaryColor = e.SecondaryColor
case *ChangedEvent:
wm.PrimaryColor = e.PrimaryColor
wm.SecondaryColor = e.SecondaryColor
}
}
return wm.WriteModel.Reduce()
}