mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-25 22:08:46 +00:00
fix: use domain models for v2 eventstore (#1151)
* fix: use domain models for v2 eventstore * fix: user domain model * Update internal/api/grpc/admin/login_policy_converter.go Co-authored-by: Livio Amstutz <[email protected]> * fix: converter Co-authored-by: Livio Amstutz <[email protected]>
This commit is contained in:
@@ -3,12 +3,11 @@ package command
|
||||
import (
|
||||
"context"
|
||||
caos_errs "github.com/caos/zitadel/internal/errors"
|
||||
usr_model "github.com/caos/zitadel/internal/user/model"
|
||||
"github.com/caos/zitadel/internal/v2/domain"
|
||||
"github.com/caos/zitadel/internal/v2/repository/user"
|
||||
)
|
||||
|
||||
func (r *CommandSide) AddHuman(ctx context.Context, orgID, username string, human *usr_model.Human) (*usr_model.Human, error) {
|
||||
func (r *CommandSide) AddHuman(ctx context.Context, orgID, username string, human *domain.Human) (*domain.Human, error) {
|
||||
if !human.IsValid() {
|
||||
return nil, caos_errs.ThrowInvalidArgument(nil, "COMMAND-4M90d", "Errors.User.Invalid")
|
||||
}
|
||||
@@ -21,16 +20,16 @@ func (r *CommandSide) AddHuman(ctx context.Context, orgID, username string, huma
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
//pwPolicy, err := r.GetOrgPasswordComplexityPolicy(ctx, orgID)
|
||||
//if err != nil {
|
||||
// return nil, err
|
||||
//}
|
||||
pwPolicy, err := r.GetOrgPasswordComplexityPolicy(ctx, orgID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
addedHuman := NewHumanWriteModel(human.AggregateID)
|
||||
//TODO: Check Unique Username
|
||||
human.CheckOrgIAMPolicy(username, orgIAMPolicy)
|
||||
human.SetNamesAsDisplayname()
|
||||
//human.HashPasswordIfExisting(pwPolicy, r.userPasswordAlg, true)
|
||||
human.HashPasswordIfExisting(pwPolicy, r.userPasswordAlg, true)
|
||||
|
||||
userAgg := UserAggregateFromWriteModel(&addedHuman.WriteModel)
|
||||
userAgg.PushEvents(
|
||||
@@ -42,7 +41,7 @@ func (r *CommandSide) AddHuman(ctx context.Context, orgID, username string, huma
|
||||
human.NickName,
|
||||
human.DisplayName,
|
||||
human.PreferredLanguage,
|
||||
domain.Gender(human.Gender),
|
||||
human.Gender,
|
||||
human.EmailAddress,
|
||||
human.PhoneNumber,
|
||||
human.Country,
|
||||
|
||||
Reference in New Issue
Block a user