MM-24440: Don't allow clearing the site url (#14694)
Summary - If the site URL is set, don't allow clearing it. Ticket Link - https://mattermost.atlassian.net/browse/MM-24440
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
d5e9fde8d7
Коммит
c58c0ba3dc
@@ -79,6 +79,10 @@ func updateConfig(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
appCfg := c.App.Config()
|
||||
if *appCfg.ServiceSettings.SiteURL != "" && *cfg.ServiceSettings.SiteURL == "" {
|
||||
c.Err = model.NewAppError("updateConfig", "api.config.update_config.clear_siteurl.app_error", nil, "", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
if *c.App.Config().ExperimentalSettings.RestrictSystemAdmin {
|
||||
// Start with the current configuration, and only merge values not marked as being
|
||||
// restricted.
|
||||
@@ -175,6 +179,10 @@ func patchConfig(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
appCfg := c.App.Config()
|
||||
if *appCfg.ServiceSettings.SiteURL != "" && *cfg.ServiceSettings.SiteURL == "" {
|
||||
c.Err = model.NewAppError("patchConfig", "api.config.update_config.clear_siteurl.app_error", nil, "", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
var filterFn utils.StructFieldFilter
|
||||
if *appCfg.ExperimentalSettings.RestrictSystemAdmin {
|
||||
filterFn = func(structField reflect.StructField, base, patch reflect.Value) bool {
|
||||
|
||||
Ссылка в новой задаче
Block a user