Fix enterprise create user to add permissions

pull/101/head
Chris Goller 2017-02-24 01:16:28 -06:00
parent d279778f4a
commit 1839cb9885
3 changed files with 8 additions and 1 deletions

View File

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

View File

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

View File

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