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

@@ -1,16 +0,0 @@
package eventstore
import (
"context"
iam_model "github.com/caos/zitadel/internal/iam/model"
"github.com/caos/zitadel/internal/query"
)
type IAMRepository struct {
IAMV2Query *query.Queries
}
func (repo *IAMRepository) IAMByID(ctx context.Context, id string) (*iam_model.IAM, error) {
return repo.IAMV2Query.IAMByID(ctx, id)
}

View File

@@ -16,7 +16,6 @@ import (
"github.com/caos/zitadel/internal/domain"
"github.com/caos/zitadel/internal/errors"
v1 "github.com/caos/zitadel/internal/eventstore/v1"
"github.com/caos/zitadel/internal/i18n"
org_model "github.com/caos/zitadel/internal/org/model"
org_es_model "github.com/caos/zitadel/internal/org/repository/eventsourcing/model"
org_view "github.com/caos/zitadel/internal/org/repository/view"
@@ -38,18 +37,6 @@ type OrgRepository struct {
supportedLangs []language.Tag
}
func (repo *OrgRepository) Languages(ctx context.Context) ([]language.Tag, error) {
if len(repo.supportedLangs) == 0 {
langs, err := i18n.SupportedLanguages(repo.LoginDir)
if err != nil {
logging.Log("ADMIN-tiMWs").WithError(err).Debug("unable to parse language")
return nil, err
}
repo.supportedLangs = langs
}
return repo.supportedLangs, nil
}
func (repo *OrgRepository) OrgChanges(ctx context.Context, id string, lastSequence uint64, limit uint64, sortAscending bool, auditLogRetention time.Duration) (*org_model.OrgChanges, error) {
changes, err := repo.getOrgChanges(ctx, id, lastSequence, limit, sortAscending, auditLogRetention)
if err != nil {

View File

@@ -24,7 +24,6 @@ type EsRepository struct {
eventstore.OrgRepository
eventstore.ProjectRepo
eventstore.UserRepo
eventstore.IAMRepository
}
func Start(conf Config, systemDefaults sd.SystemDefaults, roles []string, queries *query.Queries, staticStorage static.Storage) (*EsRepository, error) {
@@ -55,8 +54,7 @@ func Start(conf Config, systemDefaults sd.SystemDefaults, roles []string, querie
NotificationTranslationFileContents: make(map[string][]byte),
Query: queries,
},
ProjectRepo: eventstore.ProjectRepo{es, roles, systemDefaults.IamID, assetsAPI, queries},
UserRepo: eventstore.UserRepo{es, queries, systemDefaults, assetsAPI},
IAMRepository: eventstore.IAMRepository{IAMV2Query: queries},
ProjectRepo: eventstore.ProjectRepo{es, roles, systemDefaults.IamID, assetsAPI, queries},
UserRepo: eventstore.UserRepo{es, queries, systemDefaults, assetsAPI},
}, nil
}

View File

@@ -1,10 +0,0 @@
package repository
import (
"context"
iam_model "github.com/caos/zitadel/internal/iam/model"
)
type IamRepository interface {
IAMByID(ctx context.Context, id string) (*iam_model.IAM, error)
}

View File

@@ -4,13 +4,10 @@ import (
"context"
"time"
"golang.org/x/text/language"
org_model "github.com/caos/zitadel/internal/org/model"
)
type OrgRepository interface {
Languages(ctx context.Context) ([]language.Tag, error)
OrgChanges(ctx context.Context, id string, lastSequence uint64, limit uint64, sortAscending bool, auditLogRetention time.Duration) (*org_model.OrgChanges, error)
GetOrgMemberRoles(isGlobal bool) []string

View File

@@ -4,5 +4,4 @@ type Repository interface {
ProjectRepository
OrgRepository
UserRepository
IamRepository
}