Add shared channels related configuration under a E20 license check (#16415)
* Add shared channels related configuration under a E20 license check * Apply PR suggestions; Default config value for shared channels Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
@@ -84,6 +84,8 @@ type Features struct {
|
||||
EnterprisePlugins *bool `json:"enterprise_plugins"`
|
||||
AdvancedLogging *bool `json:"advanced_logging"`
|
||||
Cloud *bool `json:"cloud"`
|
||||
SharedChannels *bool `json:"shared_channels"`
|
||||
RemoteClusterService *bool `json:"remote_cluster_service"`
|
||||
|
||||
// after we enabled more features we'll need to control them with this
|
||||
FutureFeatures *bool `json:"future_features"`
|
||||
@@ -114,6 +116,8 @@ func (f *Features) ToMap() map[string]interface{} {
|
||||
"enterprise_plugins": *f.EnterprisePlugins,
|
||||
"advanced_logging": *f.AdvancedLogging,
|
||||
"cloud": *f.Cloud,
|
||||
"shared_channels": *f.SharedChannels,
|
||||
"remote_cluster_service": *f.RemoteClusterService,
|
||||
"future": *f.FutureFeatures,
|
||||
}
|
||||
}
|
||||
@@ -230,6 +234,14 @@ func (f *Features) SetDefaults() {
|
||||
if f.Cloud == nil {
|
||||
f.Cloud = NewBool(false)
|
||||
}
|
||||
|
||||
if f.SharedChannels == nil {
|
||||
f.SharedChannels = NewBool(false)
|
||||
}
|
||||
|
||||
if f.RemoteClusterService == nil {
|
||||
f.RemoteClusterService = f.SharedChannels
|
||||
}
|
||||
}
|
||||
|
||||
func (l *License) IsExpired() bool {
|
||||
|
||||
@@ -33,6 +33,8 @@ func TestLicenseFeaturesToMap(t *testing.T) {
|
||||
CheckTrue(t, m["custom_permissions_schemes"].(bool))
|
||||
CheckTrue(t, m["id_loaded"].(bool))
|
||||
CheckTrue(t, m["future"].(bool))
|
||||
CheckFalse(t, m["shared_channels"].(bool))
|
||||
CheckFalse(t, m["remote_cluster_service"].(bool))
|
||||
}
|
||||
|
||||
func TestLicenseFeaturesSetDefaults(t *testing.T) {
|
||||
@@ -57,6 +59,8 @@ func TestLicenseFeaturesSetDefaults(t *testing.T) {
|
||||
CheckTrue(t, *f.CustomPermissionsSchemes)
|
||||
CheckTrue(t, *f.GuestAccountsPermissions)
|
||||
CheckTrue(t, *f.IDLoadedPushNotifications)
|
||||
CheckFalse(t, *f.SharedChannels)
|
||||
CheckFalse(t, *f.RemoteClusterService)
|
||||
CheckTrue(t, *f.FutureFeatures)
|
||||
|
||||
f = Features{}
|
||||
@@ -82,6 +86,7 @@ func TestLicenseFeaturesSetDefaults(t *testing.T) {
|
||||
*f.GuestAccountsPermissions = true
|
||||
*f.EmailNotificationContents = true
|
||||
*f.IDLoadedPushNotifications = true
|
||||
*f.SharedChannels = true
|
||||
|
||||
f.SetDefaults()
|
||||
|
||||
@@ -104,6 +109,8 @@ func TestLicenseFeaturesSetDefaults(t *testing.T) {
|
||||
CheckTrue(t, *f.GuestAccounts)
|
||||
CheckTrue(t, *f.GuestAccountsPermissions)
|
||||
CheckTrue(t, *f.IDLoadedPushNotifications)
|
||||
CheckTrue(t, *f.SharedChannels)
|
||||
CheckTrue(t, *f.RemoteClusterService)
|
||||
CheckFalse(t, *f.FutureFeatures)
|
||||
}
|
||||
|
||||
@@ -188,6 +195,8 @@ func TestLicenseToFromJson(t *testing.T) {
|
||||
CheckBool(t, *f1.GuestAccounts, *f.GuestAccounts)
|
||||
CheckBool(t, *f1.GuestAccountsPermissions, *f.GuestAccountsPermissions)
|
||||
CheckBool(t, *f1.IDLoadedPushNotifications, *f.IDLoadedPushNotifications)
|
||||
CheckBool(t, *f1.SharedChannels, *f.SharedChannels)
|
||||
CheckBool(t, *f1.RemoteClusterService, *f.RemoteClusterService)
|
||||
CheckBool(t, *f1.FutureFeatures, *f.FutureFeatures)
|
||||
|
||||
invalid := `{"asdf`
|
||||
|
||||
Ссылка в новой задаче
Block a user