MM-14441: restrict system admin config (#10477)

* tweak utils.Merge docs

* move merge_test to utils_test package for easier testing

* utils: support MergeConfig and StructFieldFilter

* constrain updating certain fields by the restricted system admin
Этот коммит содержится в:
Jesse Hallam
2019-03-21 15:46:38 -04:00
коммит произвёл GitHub
родитель 3d92af2737
Коммит 8c8b1bbc9c
10 изменённых файлов: 316 добавлений и 220 удалений

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

@@ -4,7 +4,6 @@
package config
import (
"github.com/mattermost/mattermost-server/utils"
"io"
"sync"
@@ -141,14 +140,3 @@ func (cs *commonStore) validate(cfg *model.Config) error {
return nil
}
// mergeConfig merges two configs together. The receiver's values are overwritten with the patch's
// values except when the patch's values are nil.
func (cs *commonStore) mergeConfig(patch *model.Config) (*model.Config, error) {
ret, err := utils.Merge(cs.config, patch)
if err != nil {
return nil, err
}
retC := ret.(model.Config)
return &retC, nil
}