Only add Enterprise features to client config if enabled by license (#2768)
Этот коммит содержится в:
коммит произвёл
Corey Hulen
родитель
899ee09224
Коммит
5b5d9c0eaf
@@ -201,8 +201,6 @@ func getClientConfig(c *model.Config) map[string]string {
|
|||||||
props["EnableUserCreation"] = strconv.FormatBool(c.TeamSettings.EnableUserCreation)
|
props["EnableUserCreation"] = strconv.FormatBool(c.TeamSettings.EnableUserCreation)
|
||||||
props["RestrictTeamNames"] = strconv.FormatBool(*c.TeamSettings.RestrictTeamNames)
|
props["RestrictTeamNames"] = strconv.FormatBool(*c.TeamSettings.RestrictTeamNames)
|
||||||
props["EnableTeamListing"] = strconv.FormatBool(*c.TeamSettings.EnableTeamListing)
|
props["EnableTeamListing"] = strconv.FormatBool(*c.TeamSettings.EnableTeamListing)
|
||||||
props["EnableCustomBrand"] = strconv.FormatBool(*c.TeamSettings.EnableCustomBrand)
|
|
||||||
props["CustomBrandText"] = *c.TeamSettings.CustomBrandText
|
|
||||||
|
|
||||||
props["EnableOAuthServiceProvider"] = strconv.FormatBool(c.ServiceSettings.EnableOAuthServiceProvider)
|
props["EnableOAuthServiceProvider"] = strconv.FormatBool(c.ServiceSettings.EnableOAuthServiceProvider)
|
||||||
|
|
||||||
@@ -220,7 +218,6 @@ func getClientConfig(c *model.Config) map[string]string {
|
|||||||
props["EnableSignUpWithEmail"] = strconv.FormatBool(c.EmailSettings.EnableSignUpWithEmail)
|
props["EnableSignUpWithEmail"] = strconv.FormatBool(c.EmailSettings.EnableSignUpWithEmail)
|
||||||
props["EnableSignInWithEmail"] = strconv.FormatBool(*c.EmailSettings.EnableSignInWithEmail)
|
props["EnableSignInWithEmail"] = strconv.FormatBool(*c.EmailSettings.EnableSignInWithEmail)
|
||||||
props["EnableSignInWithUsername"] = strconv.FormatBool(*c.EmailSettings.EnableSignInWithUsername)
|
props["EnableSignInWithUsername"] = strconv.FormatBool(*c.EmailSettings.EnableSignInWithUsername)
|
||||||
props["EnableMultifactorAuthentication"] = strconv.FormatBool(*c.ServiceSettings.EnableMultifactorAuthentication)
|
|
||||||
props["RequireEmailVerification"] = strconv.FormatBool(c.EmailSettings.RequireEmailVerification)
|
props["RequireEmailVerification"] = strconv.FormatBool(c.EmailSettings.RequireEmailVerification)
|
||||||
props["FeedbackEmail"] = c.EmailSettings.FeedbackEmail
|
props["FeedbackEmail"] = c.EmailSettings.FeedbackEmail
|
||||||
|
|
||||||
@@ -240,16 +237,31 @@ func getClientConfig(c *model.Config) map[string]string {
|
|||||||
props["ProfileHeight"] = fmt.Sprintf("%v", c.FileSettings.ProfileHeight)
|
props["ProfileHeight"] = fmt.Sprintf("%v", c.FileSettings.ProfileHeight)
|
||||||
props["ProfileWidth"] = fmt.Sprintf("%v", c.FileSettings.ProfileWidth)
|
props["ProfileWidth"] = fmt.Sprintf("%v", c.FileSettings.ProfileWidth)
|
||||||
|
|
||||||
props["EnableLdap"] = strconv.FormatBool(*c.LdapSettings.Enable)
|
|
||||||
props["LdapLoginFieldName"] = *c.LdapSettings.LoginFieldName
|
|
||||||
props["LdapPasswordFieldName"] = *c.LdapSettings.PasswordFieldName
|
|
||||||
|
|
||||||
props["WebsocketPort"] = fmt.Sprintf("%v", *c.ServiceSettings.WebsocketPort)
|
props["WebsocketPort"] = fmt.Sprintf("%v", *c.ServiceSettings.WebsocketPort)
|
||||||
props["WebsocketSecurePort"] = fmt.Sprintf("%v", *c.ServiceSettings.WebsocketSecurePort)
|
props["WebsocketSecurePort"] = fmt.Sprintf("%v", *c.ServiceSettings.WebsocketSecurePort)
|
||||||
|
|
||||||
props["AllowCorsFrom"] = *c.ServiceSettings.AllowCorsFrom
|
props["AllowCorsFrom"] = *c.ServiceSettings.AllowCorsFrom
|
||||||
|
|
||||||
props["EnableCompliance"] = strconv.FormatBool(*c.ComplianceSettings.Enable)
|
if License.Features != nil {
|
||||||
|
if *License.Features.CustomBrand {
|
||||||
|
props["EnableCustomBrand"] = strconv.FormatBool(*c.TeamSettings.EnableCustomBrand)
|
||||||
|
props["CustomBrandText"] = *c.TeamSettings.CustomBrandText
|
||||||
|
}
|
||||||
|
|
||||||
|
if *License.Features.LDAP {
|
||||||
|
props["EnableLdap"] = strconv.FormatBool(*c.LdapSettings.Enable)
|
||||||
|
props["LdapLoginFieldName"] = *c.LdapSettings.LoginFieldName
|
||||||
|
props["LdapPasswordFieldName"] = *c.LdapSettings.PasswordFieldName
|
||||||
|
}
|
||||||
|
|
||||||
|
if *License.Features.MFA {
|
||||||
|
props["EnableMultifactorAuthentication"] = strconv.FormatBool(*c.ServiceSettings.EnableMultifactorAuthentication)
|
||||||
|
}
|
||||||
|
|
||||||
|
if *License.Features.Compliance {
|
||||||
|
props["EnableCompliance"] = strconv.FormatBool(*c.ComplianceSettings.Enable)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return props
|
return props
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ func SetLicense(license *model.License) bool {
|
|||||||
License = license
|
License = license
|
||||||
IsLicensed = true
|
IsLicensed = true
|
||||||
ClientLicense = getClientLicense(license)
|
ClientLicense = getClientLicense(license)
|
||||||
|
ClientCfg = getClientConfig(Cfg)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,6 +62,7 @@ func RemoveLicense() {
|
|||||||
License = &model.License{}
|
License = &model.License{}
|
||||||
IsLicensed = false
|
IsLicensed = false
|
||||||
ClientLicense = getClientLicense(License)
|
ClientLicense = getClientLicense(License)
|
||||||
|
ClientCfg = getClientConfig(Cfg)
|
||||||
}
|
}
|
||||||
|
|
||||||
func ValidateLicense(signed []byte) (bool, string) {
|
func ValidateLicense(signed []byte) (bool, string) {
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user