2021-01-04 13:52:13 +00:00
|
|
|
package command
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
2021-01-05 08:33:45 +00:00
|
|
|
"github.com/caos/zitadel/internal/v2/domain"
|
2021-01-04 13:52:13 +00:00
|
|
|
)
|
|
|
|
|
2021-01-05 08:33:45 +00:00
|
|
|
func (r *CommandSide) GetOrgPasswordComplexityPolicy(ctx context.Context, orgID string) (*domain.PasswordComplexityPolicy, error) {
|
2021-01-04 13:52:13 +00:00
|
|
|
policy := NewOrgPasswordComplexityPolicyWriteModel(orgID)
|
|
|
|
err := r.eventstore.FilterToQueryReducer(ctx, policy)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
if policy.IsActive {
|
|
|
|
return orgWriteModelToPasswordComplexityPolicy(policy), nil
|
|
|
|
}
|
2021-01-05 08:33:45 +00:00
|
|
|
return r.GetDefaultPasswordComplexityPolicy(ctx)
|
2021-01-04 13:52:13 +00:00
|
|
|
}
|