feat: Check zitadel project (#191)

* feat: check if zitadel project is changed

* feat: check if zitadel project is changed
This commit is contained in:
Fabi
2020-06-09 14:41:09 +02:00
committed by GitHub
parent 9cd7f69e61
commit e87fca28e7
9 changed files with 103 additions and 20 deletions

View File

@@ -0,0 +1,15 @@
package eventstore
import (
"context"
iam_model "github.com/caos/zitadel/internal/iam/model"
"github.com/caos/zitadel/internal/iam/repository/eventsourcing"
)
type IamRepository struct {
IamEvents *eventsourcing.IamEventstore
}
func (repo *IamRepository) IamByID(ctx context.Context, id string) (*iam_model.Iam, error) {
return repo.IamEvents.IamByID(ctx, id)
}

View File

@@ -2,6 +2,7 @@ package eventsourcing
import (
"context"
es_iam "github.com/caos/zitadel/internal/iam/repository/eventsourcing"
sd "github.com/caos/zitadel/internal/config/systemdefaults"
"github.com/caos/zitadel/internal/config/types"
@@ -32,6 +33,7 @@ type EsRepository struct {
eventstore.UserRepo
eventstore.UserGrantRepo
eventstore.PolicyRepo
eventstore.IamRepository
}
func Start(conf Config, systemDefaults sd.SystemDefaults, roles []string) (*EsRepository, error) {
@@ -78,6 +80,13 @@ func Start(conf Config, systemDefaults sd.SystemDefaults, roles []string) (*EsRe
return nil, err
}
org := es_org.StartOrg(es_org.OrgConfig{Eventstore: es})
iam, err := es_iam.StartIam(es_iam.IamConfig{
Eventstore: es,
Cache: conf.Eventstore.Cache,
}, systemDefaults)
if err != nil {
return nil, err
}
eventstoreRepos := handler.EventstoreRepos{ProjectEvents: project, UserEvents: user, OrgEvents: org}
spool := spooler.StartSpooler(conf.Spooler, es, view, sqlClient, eventstoreRepos)
@@ -89,6 +98,7 @@ func Start(conf Config, systemDefaults sd.SystemDefaults, roles []string) (*EsRe
UserRepo: eventstore.UserRepo{conf.SearchLimit, user, policy, view},
UserGrantRepo: eventstore.UserGrantRepo{conf.SearchLimit, usergrant, view},
PolicyRepo: eventstore.PolicyRepo{policy},
IamRepository: eventstore.IamRepository{iam},
}, nil
}

View File

@@ -0,0 +1,10 @@
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

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