github.com/adacta-ru/mattermost-server@v5.11.1+incompatible/app/enterprise.go (about) 1 // Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved. 2 // See License.txt for license information. 3 4 package app 5 6 import ( 7 "github.com/mattermost/mattermost-server/einterfaces" 8 ejobs "github.com/mattermost/mattermost-server/einterfaces/jobs" 9 tjobs "github.com/mattermost/mattermost-server/jobs/interfaces" 10 "github.com/mattermost/mattermost-server/mlog" 11 "github.com/mattermost/mattermost-server/model" 12 ) 13 14 var accountMigrationInterface func(*Server) einterfaces.AccountMigrationInterface 15 16 func RegisterAccountMigrationInterface(f func(*Server) einterfaces.AccountMigrationInterface) { 17 accountMigrationInterface = f 18 } 19 20 var clusterInterface func(*Server) einterfaces.ClusterInterface 21 22 func RegisterClusterInterface(f func(*Server) einterfaces.ClusterInterface) { 23 clusterInterface = f 24 } 25 26 var complianceInterface func(*App) einterfaces.ComplianceInterface 27 28 func RegisterComplianceInterface(f func(*App) einterfaces.ComplianceInterface) { 29 complianceInterface = f 30 } 31 32 var dataRetentionInterface func(*App) einterfaces.DataRetentionInterface 33 34 func RegisterDataRetentionInterface(f func(*App) einterfaces.DataRetentionInterface) { 35 dataRetentionInterface = f 36 } 37 38 var elasticsearchInterface func(*App) einterfaces.ElasticsearchInterface 39 40 func RegisterElasticsearchInterface(f func(*App) einterfaces.ElasticsearchInterface) { 41 elasticsearchInterface = f 42 } 43 44 var jobsDataRetentionJobInterface func(*App) ejobs.DataRetentionJobInterface 45 46 func RegisterJobsDataRetentionJobInterface(f func(*App) ejobs.DataRetentionJobInterface) { 47 jobsDataRetentionJobInterface = f 48 } 49 50 var jobsMessageExportJobInterface func(*App) ejobs.MessageExportJobInterface 51 52 func RegisterJobsMessageExportJobInterface(f func(*App) ejobs.MessageExportJobInterface) { 53 jobsMessageExportJobInterface = f 54 } 55 56 var jobsElasticsearchAggregatorInterface func(*App) ejobs.ElasticsearchAggregatorInterface 57 58 func RegisterJobsElasticsearchAggregatorInterface(f func(*App) ejobs.ElasticsearchAggregatorInterface) { 59 jobsElasticsearchAggregatorInterface = f 60 } 61 62 var jobsElasticsearchIndexerInterface func(*App) ejobs.ElasticsearchIndexerInterface 63 64 func RegisterJobsElasticsearchIndexerInterface(f func(*App) ejobs.ElasticsearchIndexerInterface) { 65 jobsElasticsearchIndexerInterface = f 66 } 67 68 var jobsLdapSyncInterface func(*App) ejobs.LdapSyncInterface 69 70 func RegisterJobsLdapSyncInterface(f func(*App) ejobs.LdapSyncInterface) { 71 jobsLdapSyncInterface = f 72 } 73 74 var jobsMigrationsInterface func(*App) tjobs.MigrationsJobInterface 75 76 func RegisterJobsMigrationsJobInterface(f func(*App) tjobs.MigrationsJobInterface) { 77 jobsMigrationsInterface = f 78 } 79 80 var jobsPluginsInterface func(*App) tjobs.PluginsJobInterface 81 82 func RegisterJobsPluginsJobInterface(f func(*App) tjobs.PluginsJobInterface) { 83 jobsPluginsInterface = f 84 } 85 86 var ldapInterface func(*App) einterfaces.LdapInterface 87 88 func RegisterLdapInterface(f func(*App) einterfaces.LdapInterface) { 89 ldapInterface = f 90 } 91 92 var messageExportInterface func(*App) einterfaces.MessageExportInterface 93 94 func RegisterMessageExportInterface(f func(*App) einterfaces.MessageExportInterface) { 95 messageExportInterface = f 96 } 97 98 var metricsInterface func(*App) einterfaces.MetricsInterface 99 100 func RegisterMetricsInterface(f func(*App) einterfaces.MetricsInterface) { 101 metricsInterface = f 102 } 103 104 var samlInterface func(*App) einterfaces.SamlInterface 105 106 func RegisterSamlInterface(f func(*App) einterfaces.SamlInterface) { 107 samlInterface = f 108 } 109 110 func (s *Server) initEnterprise() { 111 if accountMigrationInterface != nil { 112 s.AccountMigration = accountMigrationInterface(s) 113 } 114 if complianceInterface != nil { 115 s.Compliance = complianceInterface(s.FakeApp()) 116 } 117 if elasticsearchInterface != nil { 118 s.Elasticsearch = elasticsearchInterface(s.FakeApp()) 119 } 120 if ldapInterface != nil { 121 s.Ldap = ldapInterface(s.FakeApp()) 122 } 123 if messageExportInterface != nil { 124 s.MessageExport = messageExportInterface(s.FakeApp()) 125 } 126 if metricsInterface != nil { 127 s.Metrics = metricsInterface(s.FakeApp()) 128 } 129 if samlInterface != nil { 130 s.Saml = samlInterface(s.FakeApp()) 131 s.AddConfigListener(func(_, cfg *model.Config) { 132 if err := s.Saml.ConfigureSP(); err != nil { 133 mlog.Error("An error occurred while configuring SAML Service Provider", mlog.Err(err)) 134 } 135 }) 136 } 137 if dataRetentionInterface != nil { 138 s.DataRetention = dataRetentionInterface(s.FakeApp()) 139 } 140 if clusterInterface != nil { 141 s.Cluster = clusterInterface(s) 142 } 143 }