MM-13725 Fix client config overriding MFA enforcement set in limited config (#10095)

* Fix client config overriding MFA enforcement set in limited config

* Add unit test
Этот коммит содержится в:
Joram Wilander
2019-01-11 15:23:52 -05:00
коммит произвёл GitHub
родитель bbee234af0
Коммит 8e9df61934
2 изменённых файлов: 22 добавлений и 4 удалений

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

@@ -505,7 +505,6 @@ func GenerateClientConfig(c *model.Config, diagnosticId string, license *model.L
props["LdapNicknameAttributeSet"] = "false"
props["LdapFirstNameAttributeSet"] = "false"
props["LdapLastNameAttributeSet"] = "false"
props["EnforceMultifactorAuthentication"] = "false"
props["EnableCompliance"] = "false"
props["EnableMobileFileDownload"] = "true"
props["EnableMobileFileUpload"] = "true"
@@ -675,6 +674,7 @@ func GenerateLimitedClientConfig(c *model.Config, diagnosticId string, license *
props["CustomBrandText"] = *c.TeamSettings.CustomBrandText
props["CustomDescriptionText"] = *c.TeamSettings.CustomDescriptionText
props["EnableMultifactorAuthentication"] = strconv.FormatBool(*c.ServiceSettings.EnableMultifactorAuthentication)
props["EnforceMultifactorAuthentication"] = "false"
if license != nil {
if *license.Features.LDAP {

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

@@ -487,9 +487,10 @@ func TestGetClientConfig(t *testing.T) {
"",
nil,
map[string]string{
"DiagnosticId": "",
"EmailNotificationContentsType": "full",
"AllowCustomThemes": "true",
"DiagnosticId": "",
"EmailNotificationContentsType": "full",
"AllowCustomThemes": "true",
"EnforceMultifactorAuthentication": "false",
},
},
{
@@ -537,6 +538,23 @@ func TestGetClientConfig(t *testing.T) {
"AllowCustomThemes": "false",
},
},
{
"licensed for enforcement",
&model.Config{
ServiceSettings: model.ServiceSettings{
EnforceMultifactorAuthentication: bToP(true),
},
},
"tag1",
&model.License{
Features: &model.Features{
MFA: bToP(true),
},
},
map[string]string{
"EnforceMultifactorAuthentication": "true",
},
},
}
for _, testCase := range testCases {