MM-10606: License feature flag for custom schemes. (#8804)
* MM-10606: Add new field to license for custom schemes. * Add feature flag to license check for Schemes.
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
a09dc68e1d
Коммит
463065c8ba
@@ -56,6 +56,7 @@ type Features struct {
|
||||
EmailNotificationContents *bool `json:"email_notification_contents"`
|
||||
DataRetention *bool `json:"data_retention"`
|
||||
MessageExport *bool `json:"message_export"`
|
||||
CustomPermissionsSchemes *bool `json:"custom_permissions_schemes"`
|
||||
|
||||
// after we enabled more features for webrtc we'll need to control them with this
|
||||
FutureFeatures *bool `json:"future_features"`
|
||||
@@ -78,6 +79,7 @@ func (f *Features) ToMap() map[string]interface{} {
|
||||
"email_notification_contents": *f.EmailNotificationContents,
|
||||
"data_retention": *f.DataRetention,
|
||||
"message_export": *f.MessageExport,
|
||||
"custom_permissions_schemes": *f.CustomPermissionsSchemes,
|
||||
"future": *f.FutureFeatures,
|
||||
}
|
||||
}
|
||||
@@ -158,6 +160,10 @@ func (f *Features) SetDefaults() {
|
||||
if f.MessageExport == nil {
|
||||
f.MessageExport = NewBool(*f.FutureFeatures)
|
||||
}
|
||||
|
||||
if f.CustomPermissionsSchemes == nil {
|
||||
f.CustomPermissionsSchemes = NewBool(*f.FutureFeatures)
|
||||
}
|
||||
}
|
||||
|
||||
func (l *License) IsExpired() bool {
|
||||
|
||||
@@ -28,6 +28,8 @@ func TestLicenseFeaturesToMap(t *testing.T) {
|
||||
CheckTrue(t, m["elastic_search"].(bool))
|
||||
CheckTrue(t, m["email_notification_contents"].(bool))
|
||||
CheckTrue(t, m["data_retention"].(bool))
|
||||
CheckTrue(t, m["message_export"].(bool))
|
||||
CheckTrue(t, m["custom_permissions_schemes"].(bool))
|
||||
CheckTrue(t, m["future"].(bool))
|
||||
}
|
||||
|
||||
@@ -50,6 +52,8 @@ func TestLicenseFeaturesSetDefaults(t *testing.T) {
|
||||
CheckTrue(t, *f.Elasticsearch)
|
||||
CheckTrue(t, *f.EmailNotificationContents)
|
||||
CheckTrue(t, *f.DataRetention)
|
||||
CheckTrue(t, *f.MessageExport)
|
||||
CheckTrue(t, *f.CustomPermissionsSchemes)
|
||||
CheckTrue(t, *f.FutureFeatures)
|
||||
|
||||
f = Features{}
|
||||
@@ -70,6 +74,8 @@ func TestLicenseFeaturesSetDefaults(t *testing.T) {
|
||||
*f.PasswordRequirements = true
|
||||
*f.Elasticsearch = true
|
||||
*f.DataRetention = true
|
||||
*f.MessageExport = true
|
||||
*f.CustomPermissionsSchemes = true
|
||||
*f.EmailNotificationContents = true
|
||||
|
||||
f.SetDefaults()
|
||||
@@ -89,6 +95,8 @@ func TestLicenseFeaturesSetDefaults(t *testing.T) {
|
||||
CheckTrue(t, *f.Elasticsearch)
|
||||
CheckTrue(t, *f.EmailNotificationContents)
|
||||
CheckTrue(t, *f.DataRetention)
|
||||
CheckTrue(t, *f.MessageExport)
|
||||
CheckTrue(t, *f.CustomPermissionsSchemes)
|
||||
CheckFalse(t, *f.FutureFeatures)
|
||||
}
|
||||
|
||||
@@ -171,6 +179,8 @@ func TestLicenseToFromJson(t *testing.T) {
|
||||
CheckBool(t, *f1.PasswordRequirements, *f.PasswordRequirements)
|
||||
CheckBool(t, *f1.Elasticsearch, *f.Elasticsearch)
|
||||
CheckBool(t, *f1.DataRetention, *f.DataRetention)
|
||||
CheckBool(t, *f1.MessageExport, *f.MessageExport)
|
||||
CheckBool(t, *f1.CustomPermissionsSchemes, *f.CustomPermissionsSchemes)
|
||||
CheckBool(t, *f1.FutureFeatures, *f.FutureFeatures)
|
||||
|
||||
invalid := `{"asdf`
|
||||
|
||||
Ссылка в новой задаче
Block a user