diff options
-rw-r--r-- | api/command.go | 6 | ||||
-rw-r--r-- | api/post.go | 5 | ||||
-rw-r--r-- | api/user.go | 4 | ||||
-rw-r--r-- | config/config.json | 1 | ||||
-rw-r--r-- | utils/config.go | 1 |
5 files changed, 16 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 diff --git a/config/config.json b/config/config.json index 4eab907f7..a6c79efac 100644 --- a/config/config.json +++ b/config/config.json @@ -72,6 +72,7 @@ "TeamSettings": { "MaxUsersPerTeam": 150, "AllowPublicLink": true, + "AllowValet": false, "TermsLink": "/static/help/configure_links.html", "PrivacyLink": "/static/help/configure_links.html", "AboutLink": "/static/help/configure_links.html", diff --git a/utils/config.go b/utils/config.go index b6688de68..1060c7550 100644 --- a/utils/config.go +++ b/utils/config.go @@ -96,6 +96,7 @@ type PrivacySettings struct { type TeamSettings struct { MaxUsersPerTeam int AllowPublicLink bool + AllowValet bool TermsLink string PrivacyLink string AboutLink string |