fix(setup): set first org owner as project owner (#753)

This commit is contained in:
Silvan 2020-09-17 16:48:14 +02:00 committed by GitHub
parent 58b01cdf3f
commit e7b499794d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -228,7 +228,7 @@ func (setUp *initializer) orgs(ctx context.Context, orgs []Org) error {
return err return err
} }
err = setUp.projects(ctx, iamOrg.Projects) err = setUp.projects(ctx, iamOrg.Projects, setUp.createdUsers[iamOrg.Owners[0]].AggregateID)
if err != nil { if err != nil {
logging.LogWithFields("SETUP-wUzqY", "Org", iamOrg.Name).WithError(err).Error("unable to set up org projects") logging.LogWithFields("SETUP-wUzqY", "Org", iamOrg.Name).WithError(err).Error("unable to set up org projects")
return err return err
@ -364,9 +364,13 @@ func (setUp *initializer) orgOwner(ctx context.Context, org *org_model.Org, user
return err return err
} }
func (setUp *initializer) projects(ctx context.Context, projects []Project) error { func (setUp *initializer) projects(ctx context.Context, projects []Project, ownerID string) error {
ctxData := authz.GetCtxData(ctx)
ctxData.UserID = ownerID
projectCtx := authz.SetCtxData(ctx, ctxData)
for _, project := range projects { for _, project := range projects {
createdProject, err := setUp.project(ctx, project) createdProject, err := setUp.project(projectCtx, project)
if err != nil { if err != nil {
return err return err
} }