new pkg structure (#1150)

* fix: split command query side

* fix: split command query side

* fix: members in correct pkg structure

* fix: label policy in correct pkg structure

* fix: structure

* fix: structure of login policy

* fix: identityprovider structure

* fix: org iam policy structure

* fix: password age policy structure

* fix: password complexity policy structure

* fix: password lockout policy structure

* fix: idp structure

* fix: user events structure

* fix: user write model

* fix: profile email changed command

* fix: address changed command

* fix: user states

* fix: user

* fix: org structure and add human

* begin iam setup command side

* setup

* step2

* step2

* fix: add user

* step2

* isvalid

* fix: folder structure v2 business

Co-authored-by: Fabiennne <fabienne.gerschwiler@gmail.com>
This commit is contained in:
Livio Amstutz
2021-01-04 14:52:13 +01:00
committed by GitHub
parent 762941f0ea
commit 21ffe1b0cb
260 changed files with 7917 additions and 6570 deletions

View File

@@ -2,17 +2,17 @@ package eventstore
import (
"context"
"github.com/caos/zitadel/internal/v2/query"
"github.com/caos/zitadel/internal/iam/model"
iam_business "github.com/caos/zitadel/internal/v2/business/iam"
)
type IAMRepository struct {
IAMID string
IAMV2 *iam_business.Repository
IAMV2QuerySide *query.QuerySide
}
func (repo *IAMRepository) GetIAM(ctx context.Context) (*model.IAM, error) {
return repo.IAMV2.IAMByID(ctx, repo.IAMID)
return repo.IAMV2QuerySide.IAMByID(ctx, repo.IAMID)
}

View File

@@ -5,13 +5,13 @@ import (
"strings"
"github.com/caos/logging"
"github.com/caos/zitadel/internal/errors"
caos_errs "github.com/caos/zitadel/internal/errors"
"github.com/caos/zitadel/internal/eventstore"
"github.com/caos/zitadel/internal/eventstore/models"
es_models "github.com/caos/zitadel/internal/eventstore/models"
"github.com/caos/zitadel/internal/eventstore/spooler"
iam_model "github.com/caos/zitadel/internal/iam/model"
iam_events "github.com/caos/zitadel/internal/iam/repository/eventsourcing"
iam_es_model "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model"
org_model "github.com/caos/zitadel/internal/org/model"
@@ -25,6 +25,7 @@ import (
usr_es_model "github.com/caos/zitadel/internal/user/repository/eventsourcing/model"
grant_es_model "github.com/caos/zitadel/internal/usergrant/repository/eventsourcing/model"
view_model "github.com/caos/zitadel/internal/usergrant/repository/view/model"
"github.com/caos/zitadel/internal/v2/domain"
)
type UserGrant struct {
@@ -308,7 +309,7 @@ func (u *UserGrant) setIamProjectID() error {
return err
}
if iam.SetUpDone < iam_model.StepCount-1 {
if iam.SetUpDone < domain.StepCount-1 {
return caos_errs.ThrowPreconditionFailed(nil, "HANDL-s5DTs", "Setup not done")
}
u.iamProjectID = iam.IAMProjectID

View File

@@ -20,7 +20,7 @@ import (
es_org "github.com/caos/zitadel/internal/org/repository/eventsourcing"
es_proj "github.com/caos/zitadel/internal/project/repository/eventsourcing"
es_user "github.com/caos/zitadel/internal/user/repository/eventsourcing"
iam_business "github.com/caos/zitadel/internal/v2/business/iam"
"github.com/caos/zitadel/internal/v2/query"
)
type Config struct {
@@ -110,7 +110,7 @@ func Start(conf Config, authZ authz.Config, systemDefaults sd.SystemDefaults, au
return nil, err
}
iamV2, err := iam_business.StartRepository(&iam_business.Config{Eventstore: esV2, SystemDefaults: systemDefaults})
iamV2Query, err := query.StartQuerySide(&query.Config{Eventstore: esV2, SystemDefaults: systemDefaults})
if err != nil {
return nil, err
}
@@ -182,8 +182,8 @@ func Start(conf Config, authZ authz.Config, systemDefaults sd.SystemDefaults, au
SystemDefaults: systemDefaults,
},
eventstore.IAMRepository{
IAMID: systemDefaults.IamID,
IAMV2: iamV2,
IAMID: systemDefaults.IamID,
IAMV2QuerySide: iamV2Query,
},
}, nil
}