PLT-6504: Add ElasticSearch feature to license. (#6339)
Этот коммит содержится в:
коммит произвёл
Joram Wilander
родитель
f88769d1f2
Коммит
b25021b912
@@ -49,24 +49,26 @@ type Features struct {
|
|||||||
MHPNS *bool `json:"mhpns"`
|
MHPNS *bool `json:"mhpns"`
|
||||||
SAML *bool `json:"saml"`
|
SAML *bool `json:"saml"`
|
||||||
PasswordRequirements *bool `json:"password_requirements"`
|
PasswordRequirements *bool `json:"password_requirements"`
|
||||||
|
ElasticSearch *bool `json:"elastic_search"`
|
||||||
// after we enabled more features for webrtc we'll need to control them with this
|
// after we enabled more features for webrtc we'll need to control them with this
|
||||||
FutureFeatures *bool `json:"future_features"`
|
FutureFeatures *bool `json:"future_features"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *Features) ToMap() map[string]interface{} {
|
func (f *Features) ToMap() map[string]interface{} {
|
||||||
return map[string]interface{}{
|
return map[string]interface{}{
|
||||||
"ldap": *f.LDAP,
|
"ldap": *f.LDAP,
|
||||||
"mfa": *f.MFA,
|
"mfa": *f.MFA,
|
||||||
"google": *f.GoogleOAuth,
|
"google": *f.GoogleOAuth,
|
||||||
"office365": *f.Office365OAuth,
|
"office365": *f.Office365OAuth,
|
||||||
"compliance": *f.Compliance,
|
"compliance": *f.Compliance,
|
||||||
"cluster": *f.Cluster,
|
"cluster": *f.Cluster,
|
||||||
"metrics": *f.Metrics,
|
"metrics": *f.Metrics,
|
||||||
"custom_brand": *f.CustomBrand,
|
"custom_brand": *f.CustomBrand,
|
||||||
"mhpns": *f.MHPNS,
|
"mhpns": *f.MHPNS,
|
||||||
"saml": *f.SAML,
|
"saml": *f.SAML,
|
||||||
"password": *f.PasswordRequirements,
|
"password": *f.PasswordRequirements,
|
||||||
"future": *f.FutureFeatures,
|
"elastic_search": *f.ElasticSearch,
|
||||||
|
"future": *f.FutureFeatures,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,6 +137,11 @@ func (f *Features) SetDefaults() {
|
|||||||
f.PasswordRequirements = new(bool)
|
f.PasswordRequirements = new(bool)
|
||||||
*f.PasswordRequirements = *f.FutureFeatures
|
*f.PasswordRequirements = *f.FutureFeatures
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if f.ElasticSearch == nil {
|
||||||
|
f.ElasticSearch = new(bool)
|
||||||
|
*f.ElasticSearch = *f.FutureFeatures
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *License) IsExpired() bool {
|
func (l *License) IsExpired() bool {
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ func TestLicenseFeaturesToMap(t *testing.T) {
|
|||||||
CheckTrue(t, m["mhpns"].(bool))
|
CheckTrue(t, m["mhpns"].(bool))
|
||||||
CheckTrue(t, m["saml"].(bool))
|
CheckTrue(t, m["saml"].(bool))
|
||||||
CheckTrue(t, m["password"].(bool))
|
CheckTrue(t, m["password"].(bool))
|
||||||
|
CheckTrue(t, m["elastic_search"].(bool))
|
||||||
CheckTrue(t, m["future"].(bool))
|
CheckTrue(t, m["future"].(bool))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,6 +45,7 @@ func TestLicenseFeaturesSetDefaults(t *testing.T) {
|
|||||||
CheckTrue(t, *f.MHPNS)
|
CheckTrue(t, *f.MHPNS)
|
||||||
CheckTrue(t, *f.SAML)
|
CheckTrue(t, *f.SAML)
|
||||||
CheckTrue(t, *f.PasswordRequirements)
|
CheckTrue(t, *f.PasswordRequirements)
|
||||||
|
CheckTrue(t, *f.ElasticSearch)
|
||||||
CheckTrue(t, *f.FutureFeatures)
|
CheckTrue(t, *f.FutureFeatures)
|
||||||
|
|
||||||
f = Features{}
|
f = Features{}
|
||||||
@@ -62,6 +64,7 @@ func TestLicenseFeaturesSetDefaults(t *testing.T) {
|
|||||||
*f.MHPNS = true
|
*f.MHPNS = true
|
||||||
*f.SAML = true
|
*f.SAML = true
|
||||||
*f.PasswordRequirements = true
|
*f.PasswordRequirements = true
|
||||||
|
*f.ElasticSearch = true
|
||||||
|
|
||||||
f.SetDefaults()
|
f.SetDefaults()
|
||||||
|
|
||||||
@@ -77,6 +80,7 @@ func TestLicenseFeaturesSetDefaults(t *testing.T) {
|
|||||||
CheckTrue(t, *f.MHPNS)
|
CheckTrue(t, *f.MHPNS)
|
||||||
CheckTrue(t, *f.SAML)
|
CheckTrue(t, *f.SAML)
|
||||||
CheckTrue(t, *f.PasswordRequirements)
|
CheckTrue(t, *f.PasswordRequirements)
|
||||||
|
CheckTrue(t, *f.ElasticSearch)
|
||||||
CheckFalse(t, *f.FutureFeatures)
|
CheckFalse(t, *f.FutureFeatures)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -157,6 +161,7 @@ func TestLicenseToFromJson(t *testing.T) {
|
|||||||
CheckBool(t, *f1.MHPNS, *f.MHPNS)
|
CheckBool(t, *f1.MHPNS, *f.MHPNS)
|
||||||
CheckBool(t, *f1.SAML, *f.SAML)
|
CheckBool(t, *f1.SAML, *f.SAML)
|
||||||
CheckBool(t, *f1.PasswordRequirements, *f.PasswordRequirements)
|
CheckBool(t, *f1.PasswordRequirements, *f.PasswordRequirements)
|
||||||
|
CheckBool(t, *f1.ElasticSearch, *f.ElasticSearch)
|
||||||
CheckBool(t, *f1.FutureFeatures, *f.FutureFeatures)
|
CheckBool(t, *f1.FutureFeatures, *f.FutureFeatures)
|
||||||
|
|
||||||
invalid := `{"asdf`
|
invalid := `{"asdf`
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user