mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-12 11:04:25 +00:00
26 lines
657 B
Go
26 lines
657 B
Go
|
package command
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
|
||
|
"github.com/caos/zitadel/internal/command/v2/preparation"
|
||
|
"github.com/caos/zitadel/internal/eventstore"
|
||
|
"github.com/caos/zitadel/internal/repository/instance"
|
||
|
)
|
||
|
|
||
|
func AddDefaultDomainPolicy(
|
||
|
a *instance.Aggregate,
|
||
|
userLoginMustBeDomain bool,
|
||
|
) preparation.Validation {
|
||
|
return func() (preparation.CreateCommands, error) {
|
||
|
return func(ctx context.Context, filter preparation.FilterToQueryReducer) ([]eventstore.Command, error) {
|
||
|
//TODO: check if already exists
|
||
|
return []eventstore.Command{
|
||
|
instance.NewDomainPolicyAddedEvent(ctx, &a.Aggregate,
|
||
|
userLoginMustBeDomain,
|
||
|
),
|
||
|
}, nil
|
||
|
}, nil
|
||
|
}
|
||
|
}
|