github.com/mattermost/mattermost-server/v5@v5.39.3/config/client.go (about)

     1  // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
     2  // See LICENSE.txt for license information.
     3  
     4  package config
     5  
     6  import (
     7  	"fmt"
     8  	"strconv"
     9  	"strings"
    10  
    11  	"github.com/mattermost/mattermost-server/v5/model"
    12  )
    13  
    14  // GenerateClientConfig renders the given configuration for a client.
    15  func GenerateClientConfig(c *model.Config, telemetryID string, license *model.License) map[string]string {
    16  	props := GenerateLimitedClientConfig(c, telemetryID, license)
    17  
    18  	props["EnableCustomUserStatuses"] = strconv.FormatBool(*c.TeamSettings.EnableCustomUserStatuses)
    19  	props["EnableUserDeactivation"] = strconv.FormatBool(*c.TeamSettings.EnableUserDeactivation)
    20  	props["RestrictDirectMessage"] = *c.TeamSettings.RestrictDirectMessage
    21  	props["EnableXToLeaveChannelsFromLHS"] = strconv.FormatBool(*c.TeamSettings.EnableXToLeaveChannelsFromLHS)
    22  	props["TeammateNameDisplay"] = *c.TeamSettings.TeammateNameDisplay
    23  	props["LockTeammateNameDisplay"] = strconv.FormatBool(*c.TeamSettings.LockTeammateNameDisplay)
    24  	props["ExperimentalPrimaryTeam"] = *c.TeamSettings.ExperimentalPrimaryTeam
    25  	props["ExperimentalViewArchivedChannels"] = strconv.FormatBool(*c.TeamSettings.ExperimentalViewArchivedChannels)
    26  
    27  	props["EnableBotAccountCreation"] = strconv.FormatBool(*c.ServiceSettings.EnableBotAccountCreation)
    28  	props["EnableOAuthServiceProvider"] = strconv.FormatBool(*c.ServiceSettings.EnableOAuthServiceProvider)
    29  	props["GoogleDeveloperKey"] = *c.ServiceSettings.GoogleDeveloperKey
    30  	props["EnableIncomingWebhooks"] = strconv.FormatBool(*c.ServiceSettings.EnableIncomingWebhooks)
    31  	props["EnableOutgoingWebhooks"] = strconv.FormatBool(*c.ServiceSettings.EnableOutgoingWebhooks)
    32  	props["EnableCommands"] = strconv.FormatBool(*c.ServiceSettings.EnableCommands)
    33  	props["EnablePostUsernameOverride"] = strconv.FormatBool(*c.ServiceSettings.EnablePostUsernameOverride)
    34  	props["EnablePostIconOverride"] = strconv.FormatBool(*c.ServiceSettings.EnablePostIconOverride)
    35  	props["EnableUserAccessTokens"] = strconv.FormatBool(*c.ServiceSettings.EnableUserAccessTokens)
    36  	props["EnableLinkPreviews"] = strconv.FormatBool(*c.ServiceSettings.EnableLinkPreviews)
    37  	props["EnableTesting"] = strconv.FormatBool(*c.ServiceSettings.EnableTesting)
    38  	props["EnableDeveloper"] = strconv.FormatBool(*c.ServiceSettings.EnableDeveloper)
    39  	props["PostEditTimeLimit"] = fmt.Sprintf("%v", *c.ServiceSettings.PostEditTimeLimit)
    40  	props["MinimumHashtagLength"] = fmt.Sprintf("%v", *c.ServiceSettings.MinimumHashtagLength)
    41  	props["CloseUnusedDirectMessages"] = strconv.FormatBool(*c.ServiceSettings.CloseUnusedDirectMessages)
    42  	props["EnablePreviewFeatures"] = strconv.FormatBool(*c.ServiceSettings.EnablePreviewFeatures)
    43  	props["EnableTutorial"] = strconv.FormatBool(*c.ServiceSettings.EnableTutorial)
    44  	props["ExperimentalEnableDefaultChannelLeaveJoinMessages"] = strconv.FormatBool(*c.ServiceSettings.ExperimentalEnableDefaultChannelLeaveJoinMessages)
    45  	props["ExperimentalGroupUnreadChannels"] = *c.ServiceSettings.ExperimentalGroupUnreadChannels
    46  	props["EnableSVGs"] = strconv.FormatBool(*c.ServiceSettings.EnableSVGs)
    47  	props["EnableMarketplace"] = strconv.FormatBool(*c.PluginSettings.EnableMarketplace)
    48  	props["EnableLatex"] = strconv.FormatBool(*c.ServiceSettings.EnableLatex)
    49  	props["ExtendSessionLengthWithActivity"] = strconv.FormatBool(*c.ServiceSettings.ExtendSessionLengthWithActivity)
    50  	props["ManagedResourcePaths"] = *c.ServiceSettings.ManagedResourcePaths
    51  
    52  	// This setting is only temporary, so keep using the old setting name for the mobile and web apps
    53  	props["ExperimentalEnablePostMetadata"] = "true"
    54  	props["ExperimentalEnableClickToReply"] = strconv.FormatBool(*c.ExperimentalSettings.EnableClickToReply)
    55  
    56  	props["ExperimentalCloudUserLimit"] = strconv.FormatInt(*c.ExperimentalSettings.CloudUserLimit, 10)
    57  	props["ExperimentalCloudBilling"] = strconv.FormatBool(*c.ExperimentalSettings.CloudBilling)
    58  	if *c.ServiceSettings.ExperimentalChannelOrganization || *c.ServiceSettings.ExperimentalGroupUnreadChannels != model.GROUP_UNREAD_CHANNELS_DISABLED {
    59  		props["ExperimentalChannelOrganization"] = strconv.FormatBool(true)
    60  	} else {
    61  		props["ExperimentalChannelOrganization"] = strconv.FormatBool(false)
    62  	}
    63  
    64  	props["ExperimentalEnableAutomaticReplies"] = strconv.FormatBool(*c.TeamSettings.ExperimentalEnableAutomaticReplies)
    65  	props["ExperimentalTimezone"] = strconv.FormatBool(*c.DisplaySettings.ExperimentalTimezone)
    66  
    67  	props["SendEmailNotifications"] = strconv.FormatBool(*c.EmailSettings.SendEmailNotifications)
    68  	props["SendPushNotifications"] = strconv.FormatBool(*c.EmailSettings.SendPushNotifications)
    69  	props["RequireEmailVerification"] = strconv.FormatBool(*c.EmailSettings.RequireEmailVerification)
    70  	props["EnableEmailBatching"] = strconv.FormatBool(*c.EmailSettings.EnableEmailBatching)
    71  	props["EnablePreviewModeBanner"] = strconv.FormatBool(*c.EmailSettings.EnablePreviewModeBanner)
    72  	props["EmailNotificationContentsType"] = *c.EmailSettings.EmailNotificationContentsType
    73  
    74  	props["ShowEmailAddress"] = strconv.FormatBool(*c.PrivacySettings.ShowEmailAddress)
    75  	props["ShowFullName"] = strconv.FormatBool(*c.PrivacySettings.ShowFullName)
    76  
    77  	props["EnableFileAttachments"] = strconv.FormatBool(*c.FileSettings.EnableFileAttachments)
    78  	props["EnablePublicLink"] = strconv.FormatBool(*c.FileSettings.EnablePublicLink)
    79  
    80  	props["AvailableLocales"] = *c.LocalizationSettings.AvailableLocales
    81  	props["SQLDriverName"] = *c.SqlSettings.DriverName
    82  
    83  	props["EnableEmojiPicker"] = strconv.FormatBool(*c.ServiceSettings.EnableEmojiPicker)
    84  	props["EnableGifPicker"] = strconv.FormatBool(*c.ServiceSettings.EnableGifPicker)
    85  	props["GfycatApiKey"] = *c.ServiceSettings.GfycatApiKey
    86  	props["GfycatApiSecret"] = *c.ServiceSettings.GfycatApiSecret
    87  	props["MaxFileSize"] = strconv.FormatInt(*c.FileSettings.MaxFileSize, 10)
    88  
    89  	props["MaxNotificationsPerChannel"] = strconv.FormatInt(*c.TeamSettings.MaxNotificationsPerChannel, 10)
    90  	props["EnableConfirmNotificationsToChannel"] = strconv.FormatBool(*c.TeamSettings.EnableConfirmNotificationsToChannel)
    91  	props["TimeBetweenUserTypingUpdatesMilliseconds"] = strconv.FormatInt(*c.ServiceSettings.TimeBetweenUserTypingUpdatesMilliseconds, 10)
    92  	props["EnableUserTypingMessages"] = strconv.FormatBool(*c.ServiceSettings.EnableUserTypingMessages)
    93  	props["EnableChannelViewedMessages"] = strconv.FormatBool(*c.ServiceSettings.EnableChannelViewedMessages)
    94  
    95  	props["RunJobs"] = strconv.FormatBool(*c.JobSettings.RunJobs)
    96  
    97  	props["EnableEmailInvitations"] = strconv.FormatBool(*c.ServiceSettings.EnableEmailInvitations)
    98  
    99  	props["CloudUserLimit"] = strconv.FormatInt(*c.ExperimentalSettings.CloudUserLimit, 10)
   100  
   101  	props["EnableLegacySidebar"] = strconv.FormatBool(*c.ServiceSettings.EnableLegacySidebar)
   102  
   103  	props["EnableReliableWebSockets"] = strconv.FormatBool(*c.ServiceSettings.EnableReliableWebSockets)
   104  
   105  	// Set default values for all options that require a license.
   106  	props["ExperimentalHideTownSquareinLHS"] = "false"
   107  	props["ExperimentalTownSquareIsReadOnly"] = "false"
   108  	props["ExperimentalEnableAuthenticationTransfer"] = "true"
   109  	props["LdapNicknameAttributeSet"] = "false"
   110  	props["LdapFirstNameAttributeSet"] = "false"
   111  	props["LdapLastNameAttributeSet"] = "false"
   112  	props["LdapPictureAttributeSet"] = "false"
   113  	props["LdapPositionAttributeSet"] = "false"
   114  	props["EnableCompliance"] = "false"
   115  	props["EnableMobileFileDownload"] = "true"
   116  	props["EnableMobileFileUpload"] = "true"
   117  	props["SamlFirstNameAttributeSet"] = "false"
   118  	props["SamlLastNameAttributeSet"] = "false"
   119  	props["SamlNicknameAttributeSet"] = "false"
   120  	props["SamlPositionAttributeSet"] = "false"
   121  	props["EnableCluster"] = "false"
   122  	props["EnableMetrics"] = "false"
   123  	props["EnableBanner"] = "false"
   124  	props["BannerText"] = ""
   125  	props["BannerColor"] = ""
   126  	props["BannerTextColor"] = ""
   127  	props["AllowBannerDismissal"] = "false"
   128  	props["EnableThemeSelection"] = "true"
   129  	props["DefaultTheme"] = ""
   130  	props["AllowCustomThemes"] = "true"
   131  	props["AllowedThemes"] = ""
   132  	props["DataRetentionEnableMessageDeletion"] = "false"
   133  	props["DataRetentionMessageRetentionDays"] = "0"
   134  	props["DataRetentionEnableFileDeletion"] = "false"
   135  	props["DataRetentionFileRetentionDays"] = "0"
   136  	props["CWSUrl"] = ""
   137  
   138  	props["CustomUrlSchemes"] = strings.Join(c.DisplaySettings.CustomUrlSchemes, ",")
   139  	props["IsDefaultMarketplace"] = strconv.FormatBool(*c.PluginSettings.MarketplaceUrl == model.PLUGIN_SETTINGS_DEFAULT_MARKETPLACE_URL)
   140  	props["ExperimentalSharedChannels"] = "false"
   141  	props["CollapsedThreads"] = *c.ServiceSettings.CollapsedThreads
   142  
   143  	if license != nil {
   144  		props["ExperimentalHideTownSquareinLHS"] = strconv.FormatBool(*c.TeamSettings.ExperimentalHideTownSquareinLHS)
   145  		props["ExperimentalTownSquareIsReadOnly"] = strconv.FormatBool(*c.TeamSettings.ExperimentalTownSquareIsReadOnly)
   146  		props["ExperimentalEnableAuthenticationTransfer"] = strconv.FormatBool(*c.ServiceSettings.ExperimentalEnableAuthenticationTransfer)
   147  
   148  		if *license.Features.LDAP {
   149  			props["LdapNicknameAttributeSet"] = strconv.FormatBool(*c.LdapSettings.NicknameAttribute != "")
   150  			props["LdapFirstNameAttributeSet"] = strconv.FormatBool(*c.LdapSettings.FirstNameAttribute != "")
   151  			props["LdapLastNameAttributeSet"] = strconv.FormatBool(*c.LdapSettings.LastNameAttribute != "")
   152  			props["LdapPictureAttributeSet"] = strconv.FormatBool(*c.LdapSettings.PictureAttribute != "")
   153  			props["LdapPositionAttributeSet"] = strconv.FormatBool(*c.LdapSettings.PositionAttribute != "")
   154  		}
   155  
   156  		if *license.Features.Compliance {
   157  			props["EnableCompliance"] = strconv.FormatBool(*c.ComplianceSettings.Enable)
   158  			props["EnableMobileFileDownload"] = strconv.FormatBool(*c.FileSettings.EnableMobileDownload)
   159  			props["EnableMobileFileUpload"] = strconv.FormatBool(*c.FileSettings.EnableMobileUpload)
   160  		}
   161  
   162  		if *license.Features.SAML {
   163  			props["SamlFirstNameAttributeSet"] = strconv.FormatBool(*c.SamlSettings.FirstNameAttribute != "")
   164  			props["SamlLastNameAttributeSet"] = strconv.FormatBool(*c.SamlSettings.LastNameAttribute != "")
   165  			props["SamlNicknameAttributeSet"] = strconv.FormatBool(*c.SamlSettings.NicknameAttribute != "")
   166  			props["SamlPositionAttributeSet"] = strconv.FormatBool(*c.SamlSettings.PositionAttribute != "")
   167  
   168  			// do this under the correct licensed feature
   169  			props["ExperimentalClientSideCertEnable"] = strconv.FormatBool(*c.ExperimentalSettings.ClientSideCertEnable)
   170  			props["ExperimentalClientSideCertCheck"] = *c.ExperimentalSettings.ClientSideCertCheck
   171  		}
   172  
   173  		if *license.Features.Cluster {
   174  			props["EnableCluster"] = strconv.FormatBool(*c.ClusterSettings.Enable)
   175  		}
   176  
   177  		if *license.Features.Cluster {
   178  			props["EnableMetrics"] = strconv.FormatBool(*c.MetricsSettings.Enable)
   179  		}
   180  
   181  		if *license.Features.Announcement {
   182  			props["EnableBanner"] = strconv.FormatBool(*c.AnnouncementSettings.EnableBanner)
   183  			props["BannerText"] = *c.AnnouncementSettings.BannerText
   184  			props["BannerColor"] = *c.AnnouncementSettings.BannerColor
   185  			props["BannerTextColor"] = *c.AnnouncementSettings.BannerTextColor
   186  			props["AllowBannerDismissal"] = strconv.FormatBool(*c.AnnouncementSettings.AllowBannerDismissal)
   187  		}
   188  
   189  		if *license.Features.ThemeManagement {
   190  			props["EnableThemeSelection"] = strconv.FormatBool(*c.ThemeSettings.EnableThemeSelection)
   191  			props["DefaultTheme"] = *c.ThemeSettings.DefaultTheme
   192  			props["AllowCustomThemes"] = strconv.FormatBool(*c.ThemeSettings.AllowCustomThemes)
   193  			props["AllowedThemes"] = strings.Join(c.ThemeSettings.AllowedThemes, ",")
   194  		}
   195  
   196  		if *license.Features.DataRetention {
   197  			props["DataRetentionEnableMessageDeletion"] = strconv.FormatBool(*c.DataRetentionSettings.EnableMessageDeletion)
   198  			props["DataRetentionMessageRetentionDays"] = strconv.FormatInt(int64(*c.DataRetentionSettings.MessageRetentionDays), 10)
   199  			props["DataRetentionEnableFileDeletion"] = strconv.FormatBool(*c.DataRetentionSettings.EnableFileDeletion)
   200  			props["DataRetentionFileRetentionDays"] = strconv.FormatInt(int64(*c.DataRetentionSettings.FileRetentionDays), 10)
   201  		}
   202  
   203  		if *license.Features.Cloud {
   204  			props["CWSUrl"] = *c.CloudSettings.CWSUrl
   205  		}
   206  
   207  		if *license.Features.SharedChannels {
   208  			props["ExperimentalSharedChannels"] = strconv.FormatBool(*c.ExperimentalSettings.EnableSharedChannels)
   209  			props["ExperimentalRemoteClusterService"] = strconv.FormatBool(c.FeatureFlags.EnableRemoteClusterService && *c.ExperimentalSettings.EnableRemoteClusterService)
   210  		}
   211  	}
   212  
   213  	return props
   214  }
   215  
   216  // GenerateLimitedClientConfig renders the given configuration for an untrusted client.
   217  func GenerateLimitedClientConfig(c *model.Config, telemetryID string, license *model.License) map[string]string {
   218  	props := make(map[string]string)
   219  
   220  	props["Version"] = model.CurrentVersion
   221  	props["BuildNumber"] = model.BuildNumber
   222  	props["BuildDate"] = model.BuildDate
   223  	props["BuildHash"] = model.BuildHash
   224  	props["BuildHashEnterprise"] = model.BuildHashEnterprise
   225  	props["BuildEnterpriseReady"] = model.BuildEnterpriseReady
   226  
   227  	props["EnableBotAccountCreation"] = strconv.FormatBool(*c.ServiceSettings.EnableBotAccountCreation)
   228  	props["EnableFile"] = strconv.FormatBool(*c.LogSettings.EnableFile)
   229  	props["FileLevel"] = *c.LogSettings.FileLevel
   230  
   231  	props["SiteURL"] = strings.TrimRight(*c.ServiceSettings.SiteURL, "/")
   232  	props["SiteName"] = *c.TeamSettings.SiteName
   233  	props["WebsocketURL"] = strings.TrimRight(*c.ServiceSettings.WebsocketURL, "/")
   234  	props["WebsocketPort"] = fmt.Sprintf("%v", *c.ServiceSettings.WebsocketPort)
   235  	props["WebsocketSecurePort"] = fmt.Sprintf("%v", *c.ServiceSettings.WebsocketSecurePort)
   236  	props["EnableUserCreation"] = strconv.FormatBool(*c.TeamSettings.EnableUserCreation)
   237  	props["EnableOpenServer"] = strconv.FormatBool(*c.TeamSettings.EnableOpenServer)
   238  
   239  	props["AndroidLatestVersion"] = c.ClientRequirements.AndroidLatestVersion
   240  	props["AndroidMinVersion"] = c.ClientRequirements.AndroidMinVersion
   241  	props["DesktopLatestVersion"] = c.ClientRequirements.DesktopLatestVersion
   242  	props["DesktopMinVersion"] = c.ClientRequirements.DesktopMinVersion
   243  	props["IosLatestVersion"] = c.ClientRequirements.IosLatestVersion
   244  	props["IosMinVersion"] = c.ClientRequirements.IosMinVersion
   245  
   246  	props["EnableDiagnostics"] = strconv.FormatBool(*c.LogSettings.EnableDiagnostics)
   247  
   248  	props["EnableSignUpWithEmail"] = strconv.FormatBool(*c.EmailSettings.EnableSignUpWithEmail)
   249  	props["EnableSignInWithEmail"] = strconv.FormatBool(*c.EmailSettings.EnableSignInWithEmail)
   250  	props["EnableSignInWithUsername"] = strconv.FormatBool(*c.EmailSettings.EnableSignInWithUsername)
   251  
   252  	props["EmailLoginButtonColor"] = *c.EmailSettings.LoginButtonColor
   253  	props["EmailLoginButtonBorderColor"] = *c.EmailSettings.LoginButtonBorderColor
   254  	props["EmailLoginButtonTextColor"] = *c.EmailSettings.LoginButtonTextColor
   255  
   256  	props["EnableSignUpWithGitLab"] = strconv.FormatBool(*c.GitLabSettings.Enable)
   257  
   258  	props["TermsOfServiceLink"] = *c.SupportSettings.TermsOfServiceLink
   259  	props["PrivacyPolicyLink"] = *c.SupportSettings.PrivacyPolicyLink
   260  	props["AboutLink"] = *c.SupportSettings.AboutLink
   261  	props["HelpLink"] = *c.SupportSettings.HelpLink
   262  	props["ReportAProblemLink"] = *c.SupportSettings.ReportAProblemLink
   263  	props["SupportEmail"] = *c.SupportSettings.SupportEmail
   264  	props["EnableAskCommunityLink"] = strconv.FormatBool(*c.SupportSettings.EnableAskCommunityLink)
   265  
   266  	props["DefaultClientLocale"] = *c.LocalizationSettings.DefaultClientLocale
   267  
   268  	props["EnableCustomEmoji"] = strconv.FormatBool(*c.ServiceSettings.EnableCustomEmoji)
   269  	props["AppDownloadLink"] = *c.NativeAppSettings.AppDownloadLink
   270  	props["AndroidAppDownloadLink"] = *c.NativeAppSettings.AndroidAppDownloadLink
   271  	props["IosAppDownloadLink"] = *c.NativeAppSettings.IosAppDownloadLink
   272  
   273  	props["DiagnosticId"] = telemetryID
   274  	props["TelemetryId"] = telemetryID
   275  	props["DiagnosticsEnabled"] = strconv.FormatBool(*c.LogSettings.EnableDiagnostics)
   276  
   277  	props["HasImageProxy"] = strconv.FormatBool(*c.ImageProxySettings.Enable)
   278  
   279  	props["PluginsEnabled"] = strconv.FormatBool(*c.PluginSettings.Enable)
   280  
   281  	props["PasswordMinimumLength"] = fmt.Sprintf("%v", *c.PasswordSettings.MinimumLength)
   282  	props["PasswordRequireLowercase"] = strconv.FormatBool(*c.PasswordSettings.Lowercase)
   283  	props["PasswordRequireUppercase"] = strconv.FormatBool(*c.PasswordSettings.Uppercase)
   284  	props["PasswordRequireNumber"] = strconv.FormatBool(*c.PasswordSettings.Number)
   285  	props["PasswordRequireSymbol"] = strconv.FormatBool(*c.PasswordSettings.Symbol)
   286  
   287  	// Set default values for all options that require a license.
   288  	props["EnableCustomBrand"] = "false"
   289  	props["CustomBrandText"] = ""
   290  	props["CustomDescriptionText"] = ""
   291  	props["EnableLdap"] = "false"
   292  	props["LdapLoginFieldName"] = ""
   293  	props["LdapLoginButtonColor"] = ""
   294  	props["LdapLoginButtonBorderColor"] = ""
   295  	props["LdapLoginButtonTextColor"] = ""
   296  	props["EnableSaml"] = "false"
   297  	props["SamlLoginButtonText"] = ""
   298  	props["SamlLoginButtonColor"] = ""
   299  	props["SamlLoginButtonBorderColor"] = ""
   300  	props["SamlLoginButtonTextColor"] = ""
   301  	props["EnableSignUpWithGoogle"] = "false"
   302  	props["EnableSignUpWithOffice365"] = "false"
   303  	props["EnableSignUpWithOpenId"] = "false"
   304  	props["OpenIdButtonText"] = ""
   305  	props["OpenIdButtonColor"] = ""
   306  	props["CWSUrl"] = ""
   307  	props["EnableCustomBrand"] = strconv.FormatBool(*c.TeamSettings.EnableCustomBrand)
   308  	props["CustomBrandText"] = *c.TeamSettings.CustomBrandText
   309  	props["CustomDescriptionText"] = *c.TeamSettings.CustomDescriptionText
   310  	props["EnableMultifactorAuthentication"] = strconv.FormatBool(*c.ServiceSettings.EnableMultifactorAuthentication)
   311  	props["EnforceMultifactorAuthentication"] = "false"
   312  	props["EnableGuestAccounts"] = strconv.FormatBool(*c.GuestAccountsSettings.Enable)
   313  	props["GuestAccountsEnforceMultifactorAuthentication"] = strconv.FormatBool(*c.GuestAccountsSettings.EnforceMultifactorAuthentication)
   314  
   315  	if license != nil {
   316  		if *license.Features.LDAP {
   317  			props["EnableLdap"] = strconv.FormatBool(*c.LdapSettings.Enable)
   318  			props["LdapLoginFieldName"] = *c.LdapSettings.LoginFieldName
   319  			props["LdapLoginButtonColor"] = *c.LdapSettings.LoginButtonColor
   320  			props["LdapLoginButtonBorderColor"] = *c.LdapSettings.LoginButtonBorderColor
   321  			props["LdapLoginButtonTextColor"] = *c.LdapSettings.LoginButtonTextColor
   322  		}
   323  
   324  		if *license.Features.SAML {
   325  			props["EnableSaml"] = strconv.FormatBool(*c.SamlSettings.Enable)
   326  			props["SamlLoginButtonText"] = *c.SamlSettings.LoginButtonText
   327  			props["SamlLoginButtonColor"] = *c.SamlSettings.LoginButtonColor
   328  			props["SamlLoginButtonBorderColor"] = *c.SamlSettings.LoginButtonBorderColor
   329  			props["SamlLoginButtonTextColor"] = *c.SamlSettings.LoginButtonTextColor
   330  		}
   331  
   332  		if *license.Features.GoogleOAuth {
   333  			props["EnableSignUpWithGoogle"] = strconv.FormatBool(*c.GoogleSettings.Enable)
   334  		}
   335  
   336  		if *license.Features.Office365OAuth {
   337  			props["EnableSignUpWithOffice365"] = strconv.FormatBool(*c.Office365Settings.Enable)
   338  		}
   339  
   340  		if *license.Features.OpenId {
   341  			props["EnableSignUpWithOpenId"] = strconv.FormatBool(*c.OpenIdSettings.Enable)
   342  			props["OpenIdButtonColor"] = *c.OpenIdSettings.ButtonColor
   343  			props["OpenIdButtonText"] = *c.OpenIdSettings.ButtonText
   344  		}
   345  
   346  		if *license.Features.CustomTermsOfService {
   347  			props["EnableCustomTermsOfService"] = strconv.FormatBool(*c.SupportSettings.CustomTermsOfServiceEnabled)
   348  			props["CustomTermsOfServiceReAcceptancePeriod"] = strconv.FormatInt(int64(*c.SupportSettings.CustomTermsOfServiceReAcceptancePeriod), 10)
   349  		}
   350  
   351  		if *license.Features.MFA {
   352  			props["EnforceMultifactorAuthentication"] = strconv.FormatBool(*c.ServiceSettings.EnforceMultifactorAuthentication)
   353  		}
   354  	}
   355  
   356  	for key, value := range c.FeatureFlags.ToMap() {
   357  		props["FeatureFlag"+key] = value
   358  	}
   359  
   360  	return props
   361  }