fix(http): Ensures users are created with an active status

pull/15295/head
Deary Hudson 2019-09-27 13:43:19 -05:00 committed by Deary Hudson
parent 9f5390e449
commit bd7c4dad8f
6 changed files with 120 additions and 74 deletions

View File

@ -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

View File

@ -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"
)
@ -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

View File

@ -4,6 +4,7 @@ import (
"context"
"fmt"
"github.com/influxdata/influxdb"
platform "github.com/influxdata/influxdb"
)
@ -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
}

View File

@ -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
}

View File

@ -153,6 +153,7 @@ func Generate(
User: &platform.User{
ID: MustIDBase16(oneID),
Name: "admin",
Status: platform.Active,
},
Org: &platform.Organization{
ID: MustIDBase16(twoID),

View File

@ -163,6 +163,7 @@ func CreateUser(
{
ID: MustIDBase16(userOneID),
Name: "user1",
Status: platform.Active,
},
},
},
@ -176,6 +177,7 @@ func CreateUser(
{
ID: MustIDBase16(userOneID),
Name: "user1",
Status: platform.Active,
},
},
err: &platform.Error{
@ -237,10 +239,12 @@ func FindUserByID(
{
ID: MustIDBase16(userOneID),
Name: "user1",
Status: platform.Active,
},
{
ID: MustIDBase16(userTwoID),
Name: "user2",
Status: platform.Active,
},
},
},
@ -251,6 +255,7 @@ func FindUserByID(
user: &platform.User{
ID: MustIDBase16(userTwoID),
Name: "user2",
Status: platform.Active,
},
},
},
@ -261,10 +266,12 @@ func FindUserByID(
{
ID: MustIDBase16(userOneID),
Name: "user1",
Status: platform.Active,
},
{
ID: MustIDBase16(userTwoID),
Name: "user2",
Status: platform.Active,
},
},
},
@ -324,10 +331,12 @@ func FindUsers(
{
ID: MustIDBase16(userOneID),
Name: "abc",
Status: platform.Active,
},
{
ID: MustIDBase16(userTwoID),
Name: "xyz",
Status: platform.Active,
},
},
},
@ -337,10 +346,12 @@ func FindUsers(
{
ID: MustIDBase16(userOneID),
Name: "abc",
Status: platform.Active,
},
{
ID: MustIDBase16(userTwoID),
Name: "xyz",
Status: platform.Active,
},
},
},
@ -352,10 +363,12 @@ func FindUsers(
{
ID: MustIDBase16(userOneID),
Name: "abc",
Status: platform.Active,
},
{
ID: MustIDBase16(userTwoID),
Name: "xyz",
Status: platform.Active,
},
},
},
@ -367,6 +380,7 @@ func FindUsers(
{
ID: MustIDBase16(userTwoID),
Name: "xyz",
Status: platform.Active,
},
},
},
@ -378,10 +392,12 @@ func FindUsers(
{
ID: MustIDBase16(userOneID),
Name: "abc",
Status: platform.Active,
},
{
ID: MustIDBase16(userTwoID),
Name: "xyz",
Status: platform.Active,
},
},
},
@ -393,6 +409,7 @@ func FindUsers(
{
ID: MustIDBase16(userTwoID),
Name: "xyz",
Status: platform.Active,
},
},
},
@ -499,10 +516,12 @@ func DeleteUser(
{
Name: "orgA",
ID: MustIDBase16(userOneID),
Status: platform.Active,
},
{
Name: "orgB",
ID: MustIDBase16(userTwoID),
Status: platform.Active,
},
},
},
@ -514,6 +533,7 @@ func DeleteUser(
{
Name: "orgB",
ID: MustIDBase16(userTwoID),
Status: platform.Active,
},
},
},
@ -525,10 +545,12 @@ func DeleteUser(
{
Name: "orgA",
ID: MustIDBase16(userOneID),
Status: platform.Active,
},
{
Name: "orgB",
ID: MustIDBase16(userTwoID),
Status: platform.Active,
},
},
},
@ -545,10 +567,12 @@ func DeleteUser(
{
Name: "orgA",
ID: MustIDBase16(userOneID),
Status: platform.Active,
},
{
Name: "orgB",
ID: MustIDBase16(userTwoID),
Status: platform.Active,
},
},
},
@ -602,10 +626,12 @@ func FindUser(
{
ID: MustIDBase16(userOneID),
Name: "abc",
Status: platform.Active,
},
{
ID: MustIDBase16(userTwoID),
Name: "xyz",
Status: platform.Active,
},
},
},
@ -618,6 +644,7 @@ func FindUser(
user: &platform.User{
ID: MustIDBase16(userOneID),
Name: "abc",
Status: platform.Active,
},
},
},
@ -628,10 +655,12 @@ func FindUser(
{
ID: MustIDBase16(userOneID),
Name: "abc",
Status: platform.Active,
},
{
ID: MustIDBase16(userTwoID),
Name: "xyz",
Status: platform.Active,
},
},
},
@ -644,6 +673,7 @@ func FindUser(
user: &platform.User{
ID: MustIDBase16(userOneID),
Name: "abc",
Status: platform.Active,
},
},
},
@ -690,10 +720,12 @@ func FindUser(
{
ID: MustIDBase16(userOneID),
Name: "abc",
Status: platform.Active,
},
{
ID: MustIDBase16(userTwoID),
Name: "xyz",
Status: platform.Active,
},
},
},
@ -707,6 +739,7 @@ func FindUser(
user: &platform.User{
ID: MustIDBase16(userOneID),
Name: "abc",
Status: platform.Active,
},
},
},
@ -800,10 +833,12 @@ func UpdateUser(
{
ID: MustIDBase16(userOneID),
Name: "user1",
Status: platform.Active,
},
{
ID: MustIDBase16(userTwoID),
Name: "user2",
Status: platform.Active,
},
},
},
@ -815,6 +850,7 @@ func UpdateUser(
user: &platform.User{
ID: MustIDBase16(userOneID),
Name: "changed",
Status: platform.Active,
},
},
},