diff options
author | JoramWilander <jwawilander@gmail.com> | 2015-06-15 08:45:02 -0400 |
---|---|---|
committer | JoramWilander <jwawilander@gmail.com> | 2015-06-15 08:45:02 -0400 |
commit | 6982a61f69a0bf1e293a97cdd24ad7f1bc4e0058 (patch) | |
tree | dec06c9082b658e26aa2f49f40d3057a905c6b0d /api | |
parent | c94883e0dfc0c7cbcf86a78f9134d1e3283a07cd (diff) | |
download | chat-6982a61f69a0bf1e293a97cdd24ad7f1bc4e0058.tar.gz chat-6982a61f69a0bf1e293a97cdd24ad7f1bc4e0058.tar.bz2 chat-6982a61f69a0bf1e293a97cdd24ad7f1bc4e0058.zip |
fixes mm-1239 adds config setting to turn off valet feature
Diffstat (limited to 'api')
-rw-r--r-- | api/command.go | 6 | ||||
-rw-r--r-- | api/post.go | 5 | ||||
-rw-r--r-- | api/user.go | 4 |
3 files changed, 14 insertions, 1 deletions
diff --git a/api/command.go b/api/command.go index 9efc79b49..449483bbf 100644 --- a/api/command.go +++ b/api/command.go @@ -19,12 +19,16 @@ var commands = []commandHandler{ logoutCommand, joinCommand, loadTestCommand, - echoCommand, } func InitCommand(r *mux.Router) { l4g.Debug("Initializing command api routes") r.Handle("/command", ApiUserRequired(command)).Methods("POST") + + if utils.Cfg.TeamSettings.AllowValet { + commands = append(commands, echoCommand) + } + hub.Start() } diff --git a/api/post.go b/api/post.go index 25a68304d..0d0f2c4cf 100644 --- a/api/post.go +++ b/api/post.go @@ -58,6 +58,11 @@ func createPost(c *Context, w http.ResponseWriter, r *http.Request) { } func createValetPost(c *Context, w http.ResponseWriter, r *http.Request) { + if !utils.Cfg.TeamSettings.AllowValet { + c.Err = model.NewAppError("createValetPost", "The valet feature is currently turned off. Please contact your system administrator for details.", "") + c.Err.StatusCode = http.StatusNotImplemented + } + post := model.PostFromJson(r.Body) if post == nil { c.SetInvalidParam("createValetPost", "post") diff --git a/api/user.go b/api/user.go index c0ebc05e0..83e29b28e 100644 --- a/api/user.go +++ b/api/user.go @@ -145,6 +145,10 @@ func createUser(c *Context, w http.ResponseWriter, r *http.Request) { } func CreateValet(c *Context, team *model.Team) *model.User { + if !utils.Cfg.TeamSettings.AllowValet { + return &model.User{} + } + valet := &model.User{} valet.TeamId = team.Id valet.Email = utils.Cfg.EmailSettings.FeedbackEmail |