diff --git a/api4/plugin.go b/api4/plugin.go index 74a7c734ec..47c3ada47d 100644 --- a/api4/plugin.go +++ b/api4/plugin.go @@ -85,7 +85,9 @@ func uploadPlugin(c *Context, w http.ResponseWriter, r *http.Request) { } func installPluginFromUrl(c *Context, w http.ResponseWriter, r *http.Request) { - if !*c.App.Config().PluginSettings.Enable || *c.App.Config().PluginSettings.RequirePluginSignature { + if !*c.App.Config().PluginSettings.Enable || + *c.App.Config().PluginSettings.RequirePluginSignature || + !*c.App.Config().PluginSettings.EnableUploads { c.Err = model.NewAppError("installPluginFromUrl", "app.plugin.disabled.app_error", nil, "", http.StatusNotImplemented) return } diff --git a/api4/plugin_test.go b/api4/plugin_test.go index 7915149380..7780ec9f54 100644 --- a/api4/plugin_test.go +++ b/api4/plugin_test.go @@ -145,6 +145,9 @@ func TestPlugin(t *testing.T) { _, resp = th.SystemAdminClient.UploadPlugin(bytes.NewReader(tarData)) CheckNotImplementedStatus(t, resp) + _, resp = th.SystemAdminClient.InstallPluginFromUrl(url, false) + CheckNotImplementedStatus(t, resp) + th.App.UpdateConfig(func(cfg *model.Config) { *cfg.PluginSettings.EnableUploads = true }) _, resp = th.Client.UploadPlugin(bytes.NewReader(tarData)) CheckForbiddenStatus(t, resp)