Skip to content

Commit

Permalink
Merge pull request #15295 from influxdata/fix/http-default-empty-user…
Browse files Browse the repository at this point in the history
…-status

fix(http): Ensures users are created with an active status
  • Loading branch information
dearyhud authored Oct 1, 2019
2 parents 7d4c849 + bd7c4da commit 4f7e147
Show file tree
Hide file tree
Showing 6 changed files with 120 additions and 74 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## v2.0.0-alpha.19 [unreleased]
### Bug Fixes
1. [15295](https://github.com/influxdata/influxdb/pull/15295): Ensures users are created with an active status

## v2.0.0-alpha.18 [2019-09-26]

### Features
Expand Down
2 changes: 2 additions & 0 deletions bolt/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"time"

bolt "github.com/coreos/bbolt"
influxdb "github.com/influxdata/influxdb"
platform "github.com/influxdata/influxdb"
platformcontext "github.com/influxdata/influxdb/context"
)
Expand Down Expand Up @@ -226,6 +227,7 @@ func (c *Client) CreateUser(ctx context.Context, u *platform.User) error {
}

u.ID = c.IDGenerator.ID()
u.Status = influxdb.Active

if err := c.appendUserEventToLog(ctx, tx, u.ID, userCreatedEvent); err != nil {
return err
Expand Down
2 changes: 2 additions & 0 deletions inmem/user_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"fmt"

"github.com/influxdata/influxdb"
platform "github.com/influxdata/influxdb"
)

Expand Down Expand Up @@ -157,6 +158,7 @@ func (s *Service) CreateUser(ctx context.Context, u *platform.User) error {
}
}
u.ID = s.IDGenerator.ID()
u.Status = influxdb.Active
s.PutUser(ctx, u)
return nil
}
Expand Down
1 change: 1 addition & 0 deletions kv/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ func (s *Service) createUser(ctx context.Context, tx Tx, u *influxdb.User) error
}

u.ID = s.IDGenerator.ID()
u.Status = influxdb.Active
if err := s.appendUserEventToLog(ctx, tx, u.ID, userCreatedEvent); err != nil {
return err
}
Expand Down
5 changes: 3 additions & 2 deletions testing/onboarding.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,9 @@ func Generate(
password: "password1",
results: &platform.OnboardingResults{
User: &platform.User{
ID: MustIDBase16(oneID),
Name: "admin",
ID: MustIDBase16(oneID),
Name: "admin",
Status: platform.Active,
},
Org: &platform.Organization{
ID: MustIDBase16(twoID),
Expand Down
Loading

0 comments on commit 4f7e147

Please sign in to comment.