mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-13 03:24:26 +00:00
3eb909c4b4
* add setup steps * refactoring * omitempty * cleanup * begin org * create org * setup org * setup org * merge * fixes * fixes * fixes * add project * add oidc application * fix app creation * add resourceOwner to writemodels * resource owner * cleanup * global org, iam project and iam member in setup * logs * logs * logs * cleanup * Update internal/v2/command/project.go Co-authored-by: Fabi <38692350+fgerschwiler@users.noreply.github.com> * check project state * add org domain commands * add org status changes and member commands * fixes * policies * login policy * fix iam project event * mapper * label policy * change to command * fix * fix * handle change event differently and lot of fixes * fixes * changedEvent handling Co-authored-by: Fabi <38692350+fgerschwiler@users.noreply.github.com>
74 lines
2.2 KiB
Go
74 lines
2.2 KiB
Go
package iam
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/caos/zitadel/internal/eventstore/v2"
|
|
"github.com/caos/zitadel/internal/eventstore/v2/repository"
|
|
"github.com/caos/zitadel/internal/v2/repository/policy"
|
|
)
|
|
|
|
const (
|
|
PasswordComplexityPolicyAddedEventType = iamEventTypePrefix + policy.PasswordComplexityPolicyAddedEventType
|
|
PasswordComplexityPolicyChangedEventType = iamEventTypePrefix + policy.PasswordComplexityPolicyChangedEventType
|
|
)
|
|
|
|
type PasswordComplexityPolicyAddedEvent struct {
|
|
policy.PasswordComplexityPolicyAddedEvent
|
|
}
|
|
|
|
func NewPasswordComplexityPolicyAddedEvent(
|
|
ctx context.Context,
|
|
minLength uint64,
|
|
hasLowercase,
|
|
hasUppercase,
|
|
hasNumber,
|
|
hasSymbol bool,
|
|
) *PasswordComplexityPolicyAddedEvent {
|
|
return &PasswordComplexityPolicyAddedEvent{
|
|
PasswordComplexityPolicyAddedEvent: *policy.NewPasswordComplexityPolicyAddedEvent(
|
|
eventstore.NewBaseEventForPush(ctx, PasswordComplexityPolicyAddedEventType),
|
|
minLength,
|
|
hasLowercase,
|
|
hasUppercase,
|
|
hasNumber,
|
|
hasSymbol),
|
|
}
|
|
}
|
|
|
|
func PasswordComplexityPolicyAddedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
|
e, err := policy.PasswordComplexityPolicyAddedEventMapper(event)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &PasswordComplexityPolicyAddedEvent{PasswordComplexityPolicyAddedEvent: *e.(*policy.PasswordComplexityPolicyAddedEvent)}, nil
|
|
}
|
|
|
|
type PasswordComplexityPolicyChangedEvent struct {
|
|
policy.PasswordComplexityPolicyChangedEvent
|
|
}
|
|
|
|
func NewPasswordComplexityPolicyChangedEvent(
|
|
ctx context.Context,
|
|
changes []policy.PasswordComplexityPolicyChanges,
|
|
) (*PasswordComplexityPolicyChangedEvent, error) {
|
|
changedEvent, err := policy.NewPasswordComplexityPolicyChangedEvent(
|
|
eventstore.NewBaseEventForPush(ctx, PasswordComplexityPolicyChangedEventType),
|
|
changes,
|
|
)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &PasswordComplexityPolicyChangedEvent{PasswordComplexityPolicyChangedEvent: *changedEvent}, nil
|
|
}
|
|
|
|
func PasswordComplexityPolicyChangedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
|
e, err := policy.PasswordComplexityPolicyChangedEventMapper(event)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &PasswordComplexityPolicyChangedEvent{PasswordComplexityPolicyChangedEvent: *e.(*policy.PasswordComplexityPolicyChangedEvent)}, nil
|
|
}
|