summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorJoramWilander <jwawilander@gmail.com>2015-06-15 08:45:02 -0400
committerJoramWilander <jwawilander@gmail.com>2015-06-15 08:45:02 -0400
commit6982a61f69a0bf1e293a97cdd24ad7f1bc4e0058 (patch)
treedec06c9082b658e26aa2f49f40d3057a905c6b0d /api
parentc94883e0dfc0c7cbcf86a78f9134d1e3283a07cd (diff)
downloadchat-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.go6
-rw-r--r--api/post.go5
-rw-r--r--api/user.go4
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