diff options
author | Balasankar C <balasankarc@users.noreply.github.com> | 2018-05-18 19:27:30 +0530 |
---|---|---|
committer | Harrison Healey <harrisonmhealey@gmail.com> | 2018-05-18 09:57:30 -0400 |
commit | d3ead7dc8535f8fa5b175686cc1f7669c8b1648b (patch) | |
tree | ad6e0294e908f71c28f5fed1372c09b972e803a5 /api4 | |
parent | c6cbce610043bb050f2c542412eb439dc22c4a88 (diff) | |
download | chat-d3ead7dc8535f8fa5b175686cc1f7669c8b1648b.tar.gz chat-d3ead7dc8535f8fa5b175686cc1f7669c8b1648b.tar.bz2 chat-d3ead7dc8535f8fa5b175686cc1f7669c8b1648b.zip |
MM-10640 Set EnableUserCreation to true by default (#8815)
* Set EnableUserCreation to true by default
* Fix argument type to FormatBool
* Convert EnableUserCreation instances to pointer
* Convert to boolean in tests also
* Set value of pointer to be false
* Convert remaining EnableUserCreation instances to pointer
Diffstat (limited to 'api4')
-rw-r--r-- | api4/oauth.go | 2 | ||||
-rw-r--r-- | api4/user_test.go | 10 |
2 files changed, 6 insertions, 6 deletions
diff --git a/api4/oauth.go b/api4/oauth.go index fa120ebbf..af3d83e17 100644 --- a/api4/oauth.go +++ b/api4/oauth.go @@ -563,7 +563,7 @@ func signupWithOAuth(c *Context, w http.ResponseWriter, r *http.Request) { return } - if !c.App.Config().TeamSettings.EnableUserCreation { + if !*c.App.Config().TeamSettings.EnableUserCreation { utils.RenderWebError(w, r, http.StatusBadRequest, url.Values{ "message": []string{utils.T("api.oauth.singup_with_oauth.disabled.app_error")}, }, c.App.AsymmetricSigningKey()) diff --git a/api4/user_test.go b/api4/user_test.go index 5b4d8890a..4851f139e 100644 --- a/api4/user_test.go +++ b/api4/user_test.go @@ -63,7 +63,7 @@ func TestCreateUser(t *testing.T) { CheckBadRequestStatus(t, resp) th.App.UpdateConfig(func(cfg *model.Config) { *cfg.TeamSettings.EnableOpenServer = false }) - th.App.UpdateConfig(func(cfg *model.Config) { cfg.TeamSettings.EnableUserCreation = false }) + th.App.UpdateConfig(func(cfg *model.Config) { *cfg.TeamSettings.EnableUserCreation = false }) user2 := &model.User{Email: th.GenerateTestEmail(), Password: "Password1", Username: GenerateTestUsername()} _, resp = AdminClient.CreateUser(user2) @@ -170,13 +170,13 @@ func TestCreateUserWithToken(t *testing.T) { <-th.App.Srv.Store.Token().Save(token) defer th.App.DeleteToken(token) - th.App.UpdateConfig(func(cfg *model.Config) { cfg.TeamSettings.EnableUserCreation = false }) + th.App.UpdateConfig(func(cfg *model.Config) { *cfg.TeamSettings.EnableUserCreation = false }) _, resp := Client.CreateUserWithToken(&user, token.Token) CheckNotImplementedStatus(t, resp) CheckErrorMessage(t, resp, "api.user.create_user.signup_email_disabled.app_error") - th.App.UpdateConfig(func(cfg *model.Config) { cfg.TeamSettings.EnableUserCreation = true }) + th.App.UpdateConfig(func(cfg *model.Config) { *cfg.TeamSettings.EnableUserCreation = true }) }) t.Run("EnableOpenServerDisable", func(t *testing.T) { @@ -270,7 +270,7 @@ func TestCreateUserWithInviteId(t *testing.T) { t.Run("EnableUserCreationDisable", func(t *testing.T) { user := model.User{Email: th.GenerateTestEmail(), Nickname: "Corey Hulen", Password: "hello1", Username: GenerateTestUsername(), Roles: model.SYSTEM_ADMIN_ROLE_ID + " " + model.SYSTEM_USER_ROLE_ID} - th.App.UpdateConfig(func(cfg *model.Config) { cfg.TeamSettings.EnableUserCreation = false }) + th.App.UpdateConfig(func(cfg *model.Config) { *cfg.TeamSettings.EnableUserCreation = false }) inviteId := th.BasicTeam.InviteId @@ -278,7 +278,7 @@ func TestCreateUserWithInviteId(t *testing.T) { CheckNotImplementedStatus(t, resp) CheckErrorMessage(t, resp, "api.user.create_user.signup_email_disabled.app_error") - th.App.UpdateConfig(func(cfg *model.Config) { cfg.TeamSettings.EnableUserCreation = true }) + th.App.UpdateConfig(func(cfg *model.Config) { *cfg.TeamSettings.EnableUserCreation = true }) }) t.Run("EnableOpenServerDisable", func(t *testing.T) { |