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