Merge pull request #2374 from mattermost/PLT-2040

PLT-2040 disable executing of commands
Этот коммит содержится в:
Harrison Healey
2016-03-08 10:04:49 -05:00
родитель 93dc768156 2f92a94c3c
Коммит c18cac1f71

Просмотреть файл

@@ -69,6 +69,7 @@ func listCommands(c *Context, w http.ResponseWriter, r *http.Request) {
} }
} }
if *utils.Cfg.ServiceSettings.EnableCommands {
if result := <-Srv.Store.Command().GetByTeam(c.Session.TeamId); result.Err != nil { if result := <-Srv.Store.Command().GetByTeam(c.Session.TeamId); result.Err != nil {
c.Err = result.Err c.Err = result.Err
return return
@@ -82,6 +83,7 @@ func listCommands(c *Context, w http.ResponseWriter, r *http.Request) {
} }
} }
} }
}
w.Write([]byte(model.CommandListToJson(commands))) w.Write([]byte(model.CommandListToJson(commands)))
} }
@@ -114,6 +116,13 @@ func executeCommand(c *Context, w http.ResponseWriter, r *http.Request) {
handleResponse(c, w, response, channelId, provider.GetCommand(c), true) handleResponse(c, w, response, channelId, provider.GetCommand(c), true)
return return
} else { } else {
if !*utils.Cfg.ServiceSettings.EnableCommands {
c.Err = model.NewLocAppError("executeCommand", "api.command.disabled.app_error", nil, "")
c.Err.StatusCode = http.StatusNotImplemented
return
}
chanChan := Srv.Store.Channel().Get(channelId) chanChan := Srv.Store.Channel().Get(channelId)
teamChan := Srv.Store.Team().Get(c.Session.TeamId) teamChan := Srv.Store.Team().Get(c.Session.TeamId)
userChan := Srv.Store.User().Get(c.Session.UserId) userChan := Srv.Store.User().Get(c.Session.UserId)