From 8e9df6193439136c68befbc42a07238f2c82cb24 Mon Sep 17 00:00:00 2001 From: Joram Wilander Date: Fri, 11 Jan 2019 15:23:52 -0500 Subject: [PATCH] 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 --- utils/config.go | 2 +- utils/config_test.go | 24 +++++++++++++++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/utils/config.go b/utils/config.go index e8529f6af3..966dba347a 100644 --- a/utils/config.go +++ b/utils/config.go @@ -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 { diff --git a/utils/config_test.go b/utils/config_test.go index 74b886e36c..5dec73b549 100644 --- a/utils/config_test.go +++ b/utils/config_test.go @@ -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 {