feat: iam query (#3085)

* fix: only show factors with state ready

* fix: get iam by id and clean up code

* fix: get iam by id and clean up code

* fix: remove unused code
This commit is contained in:
Fabi
2022-01-21 14:01:25 +01:00
committed by GitHub
parent 37d8e23186
commit 01501c5087
31 changed files with 280 additions and 548 deletions

View File

@@ -21,7 +21,6 @@ import (
"github.com/caos/zitadel/internal/config/systemdefaults"
"github.com/caos/zitadel/internal/domain"
"github.com/caos/zitadel/internal/errors"
iam_model "github.com/caos/zitadel/internal/iam/model"
"github.com/caos/zitadel/internal/query"
"github.com/caos/zitadel/internal/telemetry/metrics"
"github.com/caos/zitadel/internal/telemetry/metrics/otel"
@@ -46,7 +45,7 @@ type API struct {
type health interface {
Health(ctx context.Context) error
IAMByID(ctx context.Context, id string) (*iam_model.IAM, error)
IAMByID(ctx context.Context, id string) (*query.IAM, error)
VerifierClientID(ctx context.Context, appName string) (string, string, error)
}
@@ -112,10 +111,10 @@ func (a *API) healthHandler() http.Handler {
if err != nil && !errors.IsNotFound(err) {
return errors.ThrowPreconditionFailed(err, "API-dsgT2", "IAM SETUP CHECK FAILED")
}
if iam == nil || iam.SetUpStarted < domain.StepCount-1 {
if iam == nil || iam.SetupStarted < domain.StepCount-1 {
return errors.ThrowPreconditionFailed(nil, "API-HBfs3", "IAM NOT SET UP")
}
if iam.SetUpDone < domain.StepCount-1 {
if iam.SetupDone < domain.StepCount-1 {
return errors.ThrowPreconditionFailed(nil, "API-DASs2", "IAM SETUP RUNNING")
}
return nil

View File

@@ -8,7 +8,7 @@ import (
)
func (s *Server) GetSupportedLanguages(ctx context.Context, req *auth_pb.GetSupportedLanguagesRequest) (*auth_pb.GetSupportedLanguagesResponse, error) {
langs, err := s.repo.Languages(ctx)
langs, err := s.query.Languages(ctx)
if err != nil {
return nil, err
}

View File

@@ -8,7 +8,7 @@ import (
)
func (s *Server) GetSupportedLanguages(ctx context.Context, req *mgmt_pb.GetSupportedLanguagesRequest) (*mgmt_pb.GetSupportedLanguagesResponse, error) {
langs, err := s.org.Languages(ctx)
langs, err := s.query.Languages(ctx)
if err != nil {
return nil, err
}

View File

@@ -207,7 +207,7 @@ func (s *Server) SetPrimaryOrgDomain(ctx context.Context, req *mgmt_pb.SetPrimar
}
func (s *Server) ListOrgMemberRoles(ctx context.Context, req *mgmt_pb.ListOrgMemberRolesRequest) (*mgmt_pb.ListOrgMemberRolesResponse, error) {
iam, err := s.iam.IAMByID(ctx, domain.IAMID)
iam, err := s.query.IAMByID(ctx, domain.IAMID)
if err != nil {
return nil, err
}

View File

@@ -26,7 +26,6 @@ type Server struct {
project repository.ProjectRepository
org repository.OrgRepository
user repository.UserRepository
iam repository.IamRepository
systemDefaults systemdefaults.SystemDefaults
assetAPIPrefix string
}
@@ -42,7 +41,6 @@ func CreateServer(command *command.Commands, query *query.Queries, repo reposito
project: repo,
org: repo,
user: repo,
iam: repo,
systemDefaults: sd,
assetAPIPrefix: assetAPIPrefix,
}