[MM-16798] Add a Guest Accounts feature flag (#13231)

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Miguel de la Cruz
2020-01-02 22:15:10 +01:00
коммит произвёл Jesús Espino
родитель 7a6c0f607b
Коммит c3c250cd91
6 изменённых файлов: 17 добавлений и 7 удалений

Просмотреть файл

@@ -59,6 +59,7 @@ type Features struct {
MessageExport *bool `json:"message_export"`
CustomPermissionsSchemes *bool `json:"custom_permissions_schemes"`
CustomTermsOfService *bool `json:"custom_terms_of_service"`
GuestAccounts *bool `json:"guest_accounts"`
GuestAccountsPermissions *bool `json:"guest_accounts_permissions"`
IDLoadedPushNotifications *bool `json:"id_loaded"`
LockTeammateNameDisplay *bool `json:"lock_teammate_name_display"`
@@ -84,6 +85,7 @@ func (f *Features) ToMap() map[string]interface{} {
"data_retention": *f.DataRetention,
"message_export": *f.MessageExport,
"custom_permissions_schemes": *f.CustomPermissionsSchemes,
"guest_accounts": *f.GuestAccounts,
"guest_accounts_permissions": *f.GuestAccountsPermissions,
"id_loaded": *f.IDLoadedPushNotifications,
"lock_teammate_name_display": *f.LockTeammateNameDisplay,
@@ -168,6 +170,10 @@ func (f *Features) SetDefaults() {
f.CustomPermissionsSchemes = NewBool(*f.FutureFeatures)
}
if f.GuestAccounts == nil {
f.GuestAccounts = NewBool(*f.FutureFeatures)
}
if f.GuestAccountsPermissions == nil {
f.GuestAccountsPermissions = NewBool(*f.FutureFeatures)
}

Просмотреть файл

@@ -78,6 +78,7 @@ func TestLicenseFeaturesSetDefaults(t *testing.T) {
*f.DataRetention = true
*f.MessageExport = true
*f.CustomPermissionsSchemes = true
*f.GuestAccounts = true
*f.GuestAccountsPermissions = true
*f.EmailNotificationContents = true
*f.IDLoadedPushNotifications = true
@@ -100,6 +101,7 @@ func TestLicenseFeaturesSetDefaults(t *testing.T) {
CheckTrue(t, *f.DataRetention)
CheckTrue(t, *f.MessageExport)
CheckTrue(t, *f.CustomPermissionsSchemes)
CheckTrue(t, *f.GuestAccounts)
CheckTrue(t, *f.GuestAccountsPermissions)
CheckTrue(t, *f.IDLoadedPushNotifications)
CheckFalse(t, *f.FutureFeatures)
@@ -176,6 +178,7 @@ func TestLicenseToFromJson(t *testing.T) {
CheckBool(t, *f1.DataRetention, *f.DataRetention)
CheckBool(t, *f1.MessageExport, *f.MessageExport)
CheckBool(t, *f1.CustomPermissionsSchemes, *f.CustomPermissionsSchemes)
CheckBool(t, *f1.GuestAccounts, *f.GuestAccounts)
CheckBool(t, *f1.GuestAccountsPermissions, *f.GuestAccountsPermissions)
CheckBool(t, *f1.IDLoadedPushNotifications, *f.IDLoadedPushNotifications)
CheckBool(t, *f1.FutureFeatures, *f.FutureFeatures)