Fix enterprise create user to add permissions
parent
d279778f4a
commit
1839cb9885
|
@ -17,6 +17,10 @@ func (c *UserStore) Add(ctx context.Context, u *chronograf.User) (*chronograf.Us
|
|||
if err := c.Ctrl.CreateUser(ctx, u.Name, u.Passwd); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
perms := ToEnterprise(u.Permissions)
|
||||
if err := c.Ctrl.SetUserPerms(ctx, u.Name, perms); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return u, nil
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,9 @@ func TestClient_Add(t *testing.T) {
|
|||
createUser: func(ctx context.Context, name, passwd string) error {
|
||||
return nil
|
||||
},
|
||||
setUserPerms: func(ctx context.Context, name string, perms enterprise.Permissions) error {
|
||||
return nil
|
||||
},
|
||||
},
|
||||
},
|
||||
args: args{
|
||||
|
|
|
@ -154,7 +154,7 @@ func TestService_NewSourceUser(t *testing.T) {
|
|||
ID: "1",
|
||||
wantStatus: http.StatusBadRequest,
|
||||
wantContentType: "application/json",
|
||||
wantBody: `{"code":400,"message":"Unable to connect to source 1"}`,
|
||||
wantBody: `{"code":400,"message":"Unable to connect to source 1: Biff just happens to be my supervisor"}`,
|
||||
},
|
||||
{
|
||||
name: "Failure getting source",
|
||||
|
|
Loading…
Reference in New Issue