diff --git a/pkg/server/api/console/v1/resolver.go b/pkg/server/api/console/v1/resolver.go index 12f56d7f9..2fadb8f36 100644 --- a/pkg/server/api/console/v1/resolver.go +++ b/pkg/server/api/console/v1/resolver.go @@ -185,7 +185,7 @@ func graphqlHandler(proboSvc *probo.Service, usrmgrSvc *usrmgr.Service, authCfg ctx = context.WithValue(ctx, sessionContextKey, session) ctx = context.WithValue(ctx, userContextKey, user) - ctx = context.WithValue(ctx, userTenantContextKey, tenantIDs) + ctx = context.WithValue(ctx, userTenantContextKey, &tenantIDs) srv.ServeHTTP(w, r.WithContext(ctx)) @@ -197,9 +197,9 @@ func graphqlHandler(proboSvc *probo.Service, usrmgrSvc *usrmgr.Service, authCfg } func (r *Resolver) GetTenantServiceIfAuthorized(ctx context.Context, tenantID gid.TenantID) *probo.TenantService { - tenantIDs, _ := ctx.Value(userTenantContextKey).([]gid.TenantID) + tenantIDs, _ := ctx.Value(userTenantContextKey).(*[]gid.TenantID) - for _, id := range tenantIDs { + for _, id := range *tenantIDs { if id == tenantID { return r.proboSvc.WithTenant(tenantID) } diff --git a/pkg/server/api/console/v1/v1_resolver.go b/pkg/server/api/console/v1/v1_resolver.go index 72014a1d1..721765a72 100644 --- a/pkg/server/api/console/v1/v1_resolver.go +++ b/pkg/server/api/console/v1/v1_resolver.go @@ -192,6 +192,9 @@ func (r *mutationResolver) CreateOrganization(ctx context.Context, input types.C return nil, fmt.Errorf("cannot add user to organization: %w", err) } + tenantIDs, _ := ctx.Value(userTenantContextKey).(*[]gid.TenantID) + *tenantIDs = append(*tenantIDs, organization.ID.TenantID()) + return &types.CreateOrganizationPayload{ OrganizationEdge: types.NewOrganizationEdge(organization), }, nil