forked from mattermost/mattermost-webapp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
admin_definition.jsx
5335 lines (5308 loc) · 337 KB
/
admin_definition.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import React from 'react';
import {FormattedMessage} from 'react-intl';
import {Constants} from 'utils/constants';
import {getSiteURL} from 'utils/url';
import {t} from 'utils/i18n';
import {
ldapTest, invalidateAllCaches, reloadConfig, testS3Connection,
removeIdpSamlCertificate, uploadIdpSamlCertificate,
removePrivateSamlCertificate, uploadPrivateSamlCertificate,
removePublicSamlCertificate, uploadPublicSamlCertificate,
removePrivateLdapCertificate, uploadPrivateLdapCertificate,
removePublicLdapCertificate, uploadPublicLdapCertificate,
invalidateAllEmailInvites, testSmtp, testSiteURL, getSamlMetadataFromIdp, setSamlIdpCertificateFromMetadata,
} from 'actions/admin_actions';
import SystemAnalytics from 'components/analytics/system_analytics';
import TeamAnalytics from 'components/analytics/team_analytics';
import PluginManagement from 'components/admin_console/plugin_management';
import CustomPluginSettings from 'components/admin_console/custom_plugin_settings';
import {trackEvent} from 'actions/telemetry_actions.jsx';
import Audits from './audits';
import CustomUrlSchemesSetting from './custom_url_schemes_setting.jsx';
import CustomEnableDisableGuestAccountsSetting from './custom_enable_disable_guest_accounts_setting';
import LicenseSettings from './license_settings';
import PermissionSchemesSettings from './permission_schemes_settings';
import PermissionSystemSchemeSettings from './permission_schemes_settings/permission_system_scheme_settings';
import PermissionTeamSchemeSettings from './permission_schemes_settings/permission_team_scheme_settings';
import SystemUsers from './system_users';
import SystemUserDetail from './system_user_detail';
import ServerLogs from './server_logs';
import BrandImageSetting from './brand_image_setting/brand_image_setting.jsx';
import GroupSettings from './group_settings/group_settings.jsx';
import GroupDetails from './group_settings/group_details';
import TeamSettings from './team_channel_settings/team';
import TeamDetails from './team_channel_settings/team/details';
import ChannelSettings from './team_channel_settings/channel';
import ChannelDetails from './team_channel_settings/channel/details';
import PasswordSettings from './password_settings.jsx';
import PushNotificationsSettings from './push_settings.jsx';
import DataRetentionSettings from './data_retention_settings.jsx';
import MessageExportSettings from './message_export_settings.jsx';
import DatabaseSettings from './database_settings.jsx';
import ElasticSearchSettings from './elasticsearch_settings.jsx';
import BleveSettings from './bleve_settings.jsx';
import ClusterSettings from './cluster_settings.jsx';
import CustomTermsOfServiceSettings from './custom_terms_of_service_settings';
import SessionLengthSettings from './session_length_settings';
import LDAPFeatureDiscovery from './feature_discovery/ldap.tsx';
import SAMLFeatureDiscovery from './feature_discovery/saml.tsx';
import BillingSubscriptions from './billing/billing_subscriptions.tsx';
import BillingHistory from './billing/billing_history';
import CompanyInfo from './billing/company_info';
import PaymentInfo from './billing/payment_info';
import CompanyInfoEdit from './billing/company_info_edit';
import PaymentInfoEdit from './billing/payment_info_edit';
import * as DefinitionConstants from './admin_definition_constants';
const FILE_STORAGE_DRIVER_LOCAL = 'local';
const FILE_STORAGE_DRIVER_S3 = 'amazons3';
const MEBIBYTE = Math.pow(1024, 2);
const SAML_SETTINGS_SIGNATURE_ALGORITHM_SHA1 = 'RSAwithSHA1';
const SAML_SETTINGS_SIGNATURE_ALGORITHM_SHA256 = 'RSAwithSHA256';
const SAML_SETTINGS_SIGNATURE_ALGORITHM_SHA512 = 'RSAwithSHA512';
const SAML_SETTINGS_CANONICAL_ALGORITHM_C14N = 'Canonical1.0';
const SAML_SETTINGS_CANONICAL_ALGORITHM_C14N11 = 'Canonical1.1';
// admin_definitions data structure define the autogenerated admin_console
// section. It defines the structure of the menu based on sections, subsections
// and pages. Each page contains an schema which defines a component to use for
// render the entire section or the name of the section (name and
// name_default), the section in the config file (id), and a list of options to
// configure (settings).
//
// All text fiels contains a transation key, and the <field>_default string are the
// default text when the translation is still not avaiable (the english version
// of the text).
//
// We can define different types of settings configuration widgets:
//
// Widget:
// - type: which define the widget type.
// - label (and label_default): which define the main text of the setting.
// - isDisabled: a function which receive current config, the state of the page and the license.
// - isHidden: a function which receive current config, the state of the page and the license.
//
// Custom Widget (extends from Widget):
// - component: The component used to render the widget
//
// JobsTable Widget (extends from Widget):
// - job_type: The kind of job from Constants.JobTypes
// - render_job: Function to convert a job object into a react component.
//
// Banner Widget (extends from Widget):
// - banner_type: The type of banner (options: info or warning)
//
// Setting Widget (extends from Widget):
// - key: The key to store the configuration in the config file.
// - help_text (and help_text_default): Long description of the field.
// - help_text_markdown: True if the translation text contains markdown.
// - help_text_values: Values to fill the translation (if needed).
//
// Bool Widget (extends from Setting Widget)
//
// Number Widget (extends from Setting Widget)
//
// Color Widget (extends from Setting Widget)
//
// Text Widget (extends from Setting Widget)
// - placeholder (and placeholder_default): Placeholder text to show in the input.
// - dynamic_value: function that generate the value of the field based on the current value, the config, the state and the license.
// - default_value: function that generate the default value of the field based on the config, the state and the license.
// - max_length: The maximun length allowed
//
// Button Widget (extends from Setting Widget)
// - action: A redux action to execute on click.
// - error_message (and error_message_default): Error to show if action doesn't work.
// - success_message (and success_message_default): Success message to show if action doesn't work.
//
// Language Widget (extends from Setting Widget)
// - multiple: If you can select multiple languages.
// - no_result (and no_result_default): Text to show on not results found (only for multiple = true).
// - not_present (and not_present_default): Text to show when the default language is not present (only for multiple = true).
//
// Dropdown Widget (extends from Setting Widget)
// - options: List of options of the dropdown (each options has value, display_name, display_name_default and optionally help_text, help_text_default, help_text_values, help_text_markdown fields).
//
// Permissions Flag (extends from Setting Widget)
// - permissions_mapping_name: A permission name in the utils/policy_roles_adapter.js file.
//
// FileUpload (extends from Setting Widget)
// - remove_help_text (and remove_help_text_default): Long description of the field when a file is uploaded.
// - remove_help_text_markdown: True if the translation text contains markdown.
// - remove_help_text_values: Values to fill the translation (if needed).
// - remove_button_text (and remove_button_text_default): Button text for remove when the file is uploaded.
// - removing_text (and removing_text_default): Text shown while the system is removing the file.
// - uploading_text (and uploading_text_default): Text shown while the system is uploading the file.
// - upload_action: An store action to upload the file.
// - remove_action: An store action to remove the file.
// - fileType: A list of extensions separated by ",". E.g. ".jpg,.png,.gif".
export const it = {
not: (func) => (config, state, license, enterpriseReady, consoleAccess) => {
return typeof func === 'function' ? !func(config, state, license, enterpriseReady, consoleAccess) : !func;
},
all: (...funcs) => (config, state, license, enterpriseReady, consoleAccess) => {
for (const func of funcs) {
if (typeof func === 'function' ? !func(config, state, license, enterpriseReady, consoleAccess) : !func) {
return false;
}
}
return true;
},
any: (...funcs) => (config, state, license, enterpriseReady, consoleAccess) => {
for (const func of funcs) {
if (typeof func === 'function' ? func(config, state, license, enterpriseReady, consoleAccess) : func) {
return true;
}
}
return false;
},
stateMatches: (key, regex) => (config, state) => state[key].match(regex),
stateEquals: (key, value) => (config, state) => state[key] === value,
stateIsTrue: (key) => (config, state) => Boolean(state[key]),
stateIsFalse: (key) => (config, state) => !state[key],
configIsTrue: (group, setting) => (config) => Boolean(config[group][setting]),
configIsFalse: (group, setting) => (config) => !config[group][setting],
enterpriseReady: (config, state, license, enterpriseReady) => enterpriseReady,
licensed: (config, state, license) => license.IsLicensed === 'true',
licensedForFeature: (feature) => (config, state, license) => license.IsLicensed && license[feature] === 'true',
userHasReadPermissionOnResource: (key) => (config, state, license, enterpriseReady, consoleAccess) => consoleAccess?.read?.[key],
userHasWritePermissionOnResource: (key) => (config, state, license, enterpriseReady, consoleAccess) => consoleAccess?.write?.[key],
};
const AdminDefinition = {
about: {
icon: 'fa-info-circle',
sectionTitle: t('admin.sidebar.about'),
sectionTitleDefault: 'About',
isHidden: it.any(
it.configIsTrue('ExperimentalSettings', 'RestrictSystemAdmin'),
it.not(it.userHasReadPermissionOnResource('about')),
),
license: {
url: 'about/license',
title: t('admin.sidebar.license'),
title_default: 'Edition and License',
searchableStrings: [
'admin.license.title',
'admin.license.uploadDesc',
'admin.license.keyRemove',
'admin.license.edition',
'admin.license.type',
'admin.license.key',
'Mattermost Enterprise Edition. Unlock enterprise features in this software through the purchase of a subscription from ',
'This software is offered under a commercial license.\n\nSee ENTERPRISE-EDITION-LICENSE.txt in your root install directory for details. See NOTICE.txt for information about open source software used in this system.',
],
isDisabled: it.not(it.userHasWritePermissionOnResource('about')),
schema: {
id: 'LicenseSettings',
component: LicenseSettings,
},
},
},
billing: {
icon: 'fa-credit-card', // TODO: Need compass icon
sectionTitle: t('admin.sidebar.billing'),
sectionTitleDefault: 'Billing & Account',
isHidden: it.any(
it.not(it.licensedForFeature('Cloud')),
it.configIsFalse('ExperimentalSettings', 'CloudBilling'),
),
subscription: {
url: 'billing/subscription',
title: t('admin.sidebar.subscription'),
title_default: 'Subscription',
searchableStrings: [
'admin.billing.subscription.title',
],
schema: {
id: 'BillingSubscriptions',
component: BillingSubscriptions,
},
},
billing_history: {
url: 'billing/billing_history',
title: t('admin.sidebar.billing_history'),
title_default: 'Billing History',
searchableStrings: [
'admin.billing.history.title',
],
schema: {
id: 'BillingHistory',
component: BillingHistory,
},
},
company_info: {
url: 'billing/company_info',
title: t('admin.sidebar.company_info'),
title_default: 'Company Information',
searchableStrings: [
'admin.billing.company_info.title',
],
schema: {
id: 'CompanyInfo',
component: CompanyInfo,
},
},
company_info_edit: {
url: 'billing/company_info_edit',
schema: {
id: 'CompanyInfoEdit',
component: CompanyInfoEdit,
},
},
payment_info: {
url: 'billing/payment_info',
title: t('admin.sidebar.payment_info'),
title_default: 'Payment Information',
searchableStrings: [
'admin.billing.payment_info.title',
],
schema: {
id: 'PaymentInfo',
component: PaymentInfo,
},
},
payment_info_edit: {
url: 'billing/payment_info_edit',
schema: {
id: 'PaymentInfoEdit',
component: PaymentInfoEdit,
},
},
},
reporting: {
icon: 'fa-bar-chart',
sectionTitle: t('admin.sidebar.reporting'),
sectionTitleDefault: 'Reporting',
isHidden: it.not(it.userHasReadPermissionOnResource('reporting')),
system_analytics: {
url: 'reporting/system_analytics',
title: t('admin.sidebar.siteStatistics'),
title_default: 'Site Statistics',
searchableStrings: [
'analytics.system.title',
'analytics.system.totalPosts',
'analytics.system.activeUsers',
'analytics.system.totalSessions',
'analytics.system.totalCommands',
'analytics.system.totalIncomingWebhooks',
'analytics.system.totalOutgoingWebhooks',
'analytics.system.totalWebsockets',
'analytics.system.totalMasterDbConnections',
'analytics.system.totalReadDbConnections',
'analytics.system.postTypes',
'analytics.system.channelTypes',
'analytics.system.totalUsers',
'analytics.system.totalTeams',
'analytics.system.totalChannels',
'analytics.system.dailyActiveUsers',
'analytics.system.monthlyActiveUsers',
],
schema: {
id: 'SystemAnalytics',
component: SystemAnalytics,
},
},
team_statistics: {
url: 'reporting/team_statistics',
title: t('admin.sidebar.teamStatistics'),
title_default: 'Team Statistics',
searchableStrings: [
['analytics.team.title', {team: ''}],
'analytics.system.info',
'analytics.team.totalPosts',
'analytics.team.activeUsers',
'analytics.team.totalUsers',
'analytics.team.publicChannels',
'analytics.team.privateGroups',
'analytics.team.recentUsers',
'analytics.team.newlyCreated',
],
schema: {
id: 'TeamAnalytics',
component: TeamAnalytics,
},
},
server_logs: {
url: 'reporting/server_logs',
title: t('admin.sidebar.logs'),
title_default: 'Server Logs',
isHidden: it.any(
it.configIsTrue('ExperimentalSettings', 'RestrictSystemAdmin'),
),
searchableStrings: [
'admin.logs.bannerDesc',
'admin.logs.title',
],
schema: {
id: 'ServerLogs',
component: ServerLogs,
},
},
},
user_management: {
icon: 'fa-users',
sectionTitle: t('admin.sidebar.userManagement'),
sectionTitleDefault: 'User Management',
isHidden: it.all(
it.not(it.userHasReadPermissionOnResource('user_management.users')),
it.not(it.userHasReadPermissionOnResource('user_management.groups')),
it.not(it.userHasReadPermissionOnResource('user_management.teams')),
it.not(it.userHasReadPermissionOnResource('user_management.channels')),
it.not(it.userHasReadPermissionOnResource('user_management.permissions')),
),
system_users: {
url: 'user_management/users',
title: t('admin.sidebar.users'),
title_default: 'Users',
searchableStrings: [
['admin.system_users.title', {siteName: ''}],
],
isDisabled: it.not(it.userHasWritePermissionOnResource('user_management.users')),
isHidden: it.not(it.userHasReadPermissionOnResource('user_management.users')),
schema: {
id: 'SystemUsers',
component: SystemUsers,
},
},
system_user_detail: {
url: 'user_management/user/:user_id',
isDisabled: it.not(it.userHasWritePermissionOnResource('user_management.users')),
schema: {
id: 'SystemUserDetail',
component: SystemUserDetail,
},
},
group_detail: {
url: 'user_management/groups/:group_id',
isDisabled: it.not(it.userHasWritePermissionOnResource('user_management.groups')),
schema: {
id: 'GroupDetail',
component: GroupDetails,
},
},
groups: {
url: 'user_management/groups',
title: t('admin.sidebar.groups'),
title_default: 'Groups',
isHidden: it.any(
it.not(it.licensedForFeature('LDAPGroups')),
it.not(it.userHasReadPermissionOnResource('user_management.groups')),
),
isDisabled: it.not(it.userHasWritePermissionOnResource('user_management.groups')),
schema: {
id: 'Groups',
component: GroupSettings,
},
},
team_detail: {
url: 'user_management/teams/:team_id',
isDisabled: it.not(it.userHasWritePermissionOnResource('user_management.teams')),
schema: {
id: 'TeamDetail',
component: TeamDetails,
},
},
teams: {
url: 'user_management/teams',
title: t('admin.sidebar.teams'),
title_default: 'Teams',
isHidden: it.any(
it.not(it.licensedForFeature('LDAPGroups')),
it.not(it.userHasReadPermissionOnResource('user_management.teams')),
),
schema: {
id: 'Teams',
component: TeamSettings,
},
},
channel_detail: {
url: 'user_management/channels/:channel_id',
isDisabled: it.not(it.userHasWritePermissionOnResource('user_management.channels')),
schema: {
id: 'ChannelDetail',
component: ChannelDetails,
},
},
channel: {
url: 'user_management/channels',
title: t('admin.sidebar.channels'),
title_default: 'Channels',
isHidden: it.any(
it.not(it.licensedForFeature('LDAPGroups')),
it.not(it.userHasReadPermissionOnResource('user_management.channels')),
),
isDisabled: it.not(it.userHasWritePermissionOnResource('user_management.channels')),
schema: {
id: 'Channels',
component: ChannelSettings,
},
},
systemScheme: {
url: 'user_management/permissions/system_scheme',
isDisabled: it.not(it.userHasWritePermissionOnResource('user_management.permissions')),
schema: {
id: 'PermissionSystemScheme',
component: PermissionSystemSchemeSettings,
},
},
teamSchemeDetail: {
url: 'user_management/permissions/team_override_scheme/:scheme_id',
isDisabled: it.not(it.userHasWritePermissionOnResource('user_management.permissions')),
schema: {
id: 'PermissionSystemScheme',
component: PermissionTeamSchemeSettings,
},
},
teamScheme: {
url: 'user_management/permissions/team_override_scheme',
isDisabled: it.not(it.userHasWritePermissionOnResource('user_management.permissions')),
schema: {
id: 'PermissionSystemScheme',
component: PermissionTeamSchemeSettings,
},
},
permissions: {
url: 'user_management/permissions/',
title: t('admin.sidebar.permissions'),
title_default: 'Permissions',
searchableStrings: [
'admin.permissions.documentationLinkText',
'admin.permissions.teamOverrideSchemesNoSchemes',
'admin.permissions.loadMoreSchemes',
'admin.permissions.introBanner',
'admin.permissions.systemSchemeBannerTitle',
'admin.permissions.systemSchemeBannerText',
'admin.permissions.systemSchemeBannerButton',
'admin.permissions.teamOverrideSchemesTitle',
'admin.permissions.teamOverrideSchemesBannerText',
'admin.permissions.teamOverrideSchemesNewButton',
],
isHidden: it.any(
it.not(it.licensed),
it.not(it.userHasReadPermissionOnResource('user_management.permissions')),
),
isDisabled: it.not(it.userHasWritePermissionOnResource('user_management.permissions')),
schema: {
id: 'PermissionSchemes',
component: PermissionSchemesSettings,
},
},
},
environment: {
icon: 'fa-server',
sectionTitle: t('admin.sidebar.environment'),
sectionTitleDefault: 'Environment',
isHidden: it.not(it.userHasReadPermissionOnResource('environment')),
web_server: {
url: 'environment/web_server',
title: t('admin.sidebar.webServer'),
title_default: 'Web Server',
isHidden: it.configIsTrue('ExperimentalSettings', 'RestrictSystemAdmin'),
schema: {
id: 'ServiceSettings',
name: t('admin.environment.webServer'),
name_default: 'Web Server',
settings: [
{
type: Constants.SettingsTypes.TYPE_BANNER,
label: t('admin.rate.noteDescription'),
label_default: 'Changing properties in this section will require a server restart before taking effect.',
banner_type: 'info',
},
{
type: Constants.SettingsTypes.TYPE_TEXT,
key: 'ServiceSettings.SiteURL',
label: t('admin.service.siteURL'),
label_default: 'Site URL:',
help_text: t('admin.service.siteURLDescription'),
help_text_default: 'The URL that users will use to access Mattermost. Standard ports, such as 80 and 443, can be omitted, but non-standard ports are required. For example: https://example.com:8065. This setting is required.\n \nMattermost may be hosted at a subpath. For example: https://example.com:8065/company/mattermost. A restart is required before the server will work correctly.',
help_text_markdown: true,
placeholder: t('admin.service.siteURLExample'),
placeholder_default: 'E.g.: "https://example.com:8065"',
isDisabled: it.not(it.userHasWritePermissionOnResource('environment')),
},
{
type: Constants.SettingsTypes.TYPE_BUTTON,
key: 'TestSiteURL',
action: testSiteURL,
label: t('admin.service.testSiteURL'),
label_default: 'Test Live URL',
loading: t('admin.service.testSiteURLTesting'),
loading_default: 'Testing...',
error_message: t('admin.service.testSiteURLFail'),
error_message_default: 'Test unsuccessful: {error}',
success_message: t('admin.service.testSiteURLSuccess'),
success_message_default: 'Test successful. This is a valid URL.',
isDisabled: it.not(it.userHasReadPermissionOnResource('environment')),
},
{
type: Constants.SettingsTypes.TYPE_TEXT,
key: 'ServiceSettings.ListenAddress',
label: t('admin.service.listenAddress'),
label_default: 'Listen Address:',
placeholder: t('admin.service.listenExample'),
placeholder_default: 'E.g.: ":8065"',
help_text: t('admin.service.listenDescription'),
help_text_default: 'The address and port to which to bind and listen. Specifying ":8065" will bind to all network interfaces. Specifying "127.0.0.1:8065" will only bind to the network interface having that IP address. If you choose a port of a lower level (called "system ports" or "well-known ports", in the range of 0-1023), you must have permissions to bind to that port. On Linux you can use: "sudo setcap cap_net_bind_service=+ep ./bin/mattermost" to allow Mattermost to bind to well-known ports.',
isDisabled: it.not(it.userHasWritePermissionOnResource('environment')),
},
{
type: Constants.SettingsTypes.TYPE_BOOL,
key: 'ServiceSettings.Forward80To443',
label: t('admin.service.forward80To443'),
label_default: 'Forward port 80 to 443:',
help_text: t('admin.service.forward80To443Description'),
help_text_default: 'Forwards all insecure traffic from port 80 to secure port 443. Not recommended when using a proxy server.',
disabled_help_text: t('admin.service.forward80To443Description.disabled'),
disabled_help_text_default: 'Forwards all insecure traffic from port 80 to secure port 443. Not recommended when using a proxy server.\n \nThis setting cannot be enabled until your server is [listening](#ListenAddress) on port 443.',
disabled_help_text_markdown: true,
isDisabled: it.any(
it.not(it.userHasWritePermissionOnResource('environment')),
it.not(it.stateMatches('ServiceSettings.ListenAddress', /:443$/)),
),
},
{
type: Constants.SettingsTypes.TYPE_DROPDOWN,
key: 'ServiceSettings.ConnectionSecurity',
label: t('admin.connectionSecurityTitle'),
label_default: 'Connection Security:',
help_text: DefinitionConstants.CONNECTION_SECURITY_HELP_TEXT_WEBSERVER,
options: [
{
value: '',
display_name: t('admin.connectionSecurityNone'),
display_name_default: 'None',
},
{
value: 'TLS',
display_name: t('admin.connectionSecurityTls'),
display_name_default: 'TLS (Recommended)',
},
],
isDisabled: it.not(it.userHasWritePermissionOnResource('environment')),
},
{
type: Constants.SettingsTypes.TYPE_TEXT,
key: 'ServiceSettings.TLSCertFile',
label: t('admin.service.tlsCertFile'),
label_default: 'TLS Certificate File:',
help_text: t('admin.service.tlsCertFileDescription'),
help_text_default: 'The certificate file to use.',
isDisabled: it.any(
it.not(it.userHasWritePermissionOnResource('environment')),
it.stateIsTrue('ServiceSettings.UseLetsEncrypt'),
),
},
{
type: Constants.SettingsTypes.TYPE_TEXT,
key: 'ServiceSettings.TLSKeyFile',
label: t('admin.service.tlsKeyFile'),
label_default: 'TLS Key File:',
help_text: t('admin.service.tlsKeyFileDescription'),
help_text_default: 'The private key file to use.',
isDisabled: it.any(
it.not(it.userHasWritePermissionOnResource('environment')),
it.stateIsTrue('ServiceSettings.UseLetsEncrypt'),
),
},
{
type: Constants.SettingsTypes.TYPE_BOOL,
key: 'ServiceSettings.UseLetsEncrypt',
label: t('admin.service.useLetsEncrypt'),
label_default: 'Use Let\'s Encrypt:',
help_text: t('admin.service.useLetsEncryptDescription'),
help_text_default: 'Enable the automatic retrieval of certificates from Let\'s Encrypt. The certificate will be retrieved when a client attempts to connect from a new domain. This will work with multiple domains.',
disabled_help_text: t('admin.service.useLetsEncryptDescription.disabled'),
disabled_help_text_default: 'Enable the automatic retrieval of certificates from Let\'s Encrypt. The certificate will be retrieved when a client attempts to connect from a new domain. This will work with multiple domains.\n \nThis setting cannot be enabled unless the [Forward port 80 to 443](#Forward80To443) setting is set to true.',
disabled_help_text_markdown: true,
isDisabled: it.any(
it.not(it.userHasWritePermissionOnResource('environment')),
it.stateIsFalse('ServiceSettings.Forward80To443'),
),
},
{
type: Constants.SettingsTypes.TYPE_TEXT,
key: 'ServiceSettings.LetsEncryptCertificateCacheFile',
label: t('admin.service.letsEncryptCertificateCacheFile'),
label_default: 'Let\'s Encrypt Certificate Cache File:',
help_text: t('admin.service.letsEncryptCertificateCacheFileDescription'),
help_text_default: 'Certificates retrieved and other data about the Let\'s Encrypt service will be stored in this file.',
isDisabled: it.any(
it.not(it.userHasWritePermissionOnResource('environment')),
it.stateIsFalse('ServiceSettings.UseLetsEncrypt'),
),
},
{
type: Constants.SettingsTypes.TYPE_NUMBER,
key: 'ServiceSettings.ReadTimeout',
label: t('admin.service.readTimeout'),
label_default: 'Read Timeout:',
help_text: t('admin.service.readTimeoutDescription'),
help_text_default: 'Maximum time allowed from when the connection is accepted to when the request body is fully read.',
isDisabled: it.not(it.userHasWritePermissionOnResource('environment')),
},
{
type: Constants.SettingsTypes.TYPE_NUMBER,
key: 'ServiceSettings.WriteTimeout',
label: t('admin.service.writeTimeout'),
label_default: 'Write Timeout:',
help_text: t('admin.service.writeTimeoutDescription'),
help_text_default: 'If using HTTP (insecure), this is the maximum time allowed from the end of reading the request headers until the response is written. If using HTTPS, it is the total time from when the connection is accepted until the response is written.',
isDisabled: it.not(it.userHasWritePermissionOnResource('environment')),
},
{
type: Constants.SettingsTypes.TYPE_DROPDOWN,
key: 'ServiceSettings.WebserverMode',
label: t('admin.webserverModeTitle'),
label_default: 'Webserver Mode:',
help_text: DefinitionConstants.WEBSERVER_MODE_HELP_TEXT,
options: [
{
value: 'gzip',
display_name: t('admin.webserverModeGzip'),
display_name_default: 'gzip',
},
{
value: 'uncompressed',
display_name: t('admin.webserverModeUncompressed'),
display_name_default: 'Uncompressed',
},
{
value: 'disabled',
display_name: t('admin.webserverModeDisabled'),
display_name_default: 'Disabled',
},
],
isDisabled: it.not(it.userHasWritePermissionOnResource('environment')),
},
{
type: Constants.SettingsTypes.TYPE_BOOL,
key: 'ServiceSettings.EnableInsecureOutgoingConnections',
label: t('admin.service.insecureTlsTitle'),
label_default: 'Enable Insecure Outgoing Connections: ',
help_text: t('admin.service.insecureTlsDesc'),
help_text_default: 'When true, any outgoing HTTPS requests will accept unverified, self-signed certificates. For example, outgoing webhooks to a server with a self-signed TLS certificate, using any domain, will be allowed. Note that this makes these connections susceptible to man-in-the-middle attacks.',
isDisabled: it.not(it.userHasWritePermissionOnResource('environment')),
},
{
type: Constants.SettingsTypes.TYPE_BUTTON,
action: reloadConfig,
key: 'ReloadConfigButton',
label: t('admin.reload.button'),
label_default: 'Reload Configuration From Disk',
help_text: t('admin.reload.reloadDescription'),
help_text_default: 'Deployments using multiple databases can switch from one master database to another without restarting the Mattermost server by updating "config.json" to the new desired configuration and using the {featureName} feature to load the new settings while the server is running. The administrator should then use the {recycleDatabaseConnections} feature to recycle the database connections based on the new settings.',
help_text_values: {
featureName: (
<b>
<FormattedMessage
id='admin.reload.reloadDescription.featureName'
defaultMessage='Reload Configuration from Disk'
/>
</b>
),
recycleDatabaseConnections: (
<a href='../environment/database'>
<b>
<FormattedMessage
id='admin.reload.reloadDescription.recycleDatabaseConnections'
defaultMessage='Environment > Database > Recycle Database Connections'
/>
</b>
</a>
),
},
error_message: t('admin.reload.reloadFail'),
error_message_default: 'Reload unsuccessful: {error}',
isDisabled: it.not(it.userHasWritePermissionOnResource('environment')),
},
{
type: Constants.SettingsTypes.TYPE_BUTTON,
key: 'PurgeButton',
action: invalidateAllCaches,
label: t('admin.purge.button'),
label_default: 'Purge All Caches',
help_text: t('admin.purge.purgeDescription'),
help_text_default: 'This will purge all the in-memory caches for things like sessions, accounts, channels, etc. Deployments using High Availability will attempt to purge all the servers in the cluster. Purging the caches may adversely impact performance.',
error_message: t('admin.purge.purgeFail'),
error_message_default: 'Purging unsuccessful: {error}',
isDisabled: it.not(it.userHasWritePermissionOnResource('environment')),
},
],
},
},
database: {
url: 'environment/database',
title: t('admin.sidebar.database'),
title_default: 'Database',
searchableStrings: [
'admin.database.title',
['admin.recycle.recycleDescription', {featureName: '', reloadConfiguration: ''}],
'admin.recycle.recycleDescription.featureName',
'admin.recycle.recycleDescription.reloadConfiguration',
'admin.recycle.button',
'admin.sql.noteDescription',
'admin.sql.disableDatabaseSearchTitle',
'admin.sql.disableDatabaseSearchDescription',
'admin.sql.driverName',
'admin.sql.driverNameDescription',
'admin.sql.dataSource',
'admin.sql.dataSourceDescription',
'admin.sql.maxConnectionsTitle',
'admin.sql.maxConnectionsDescription',
'admin.sql.maxOpenTitle',
'admin.sql.maxOpenDescription',
'admin.sql.queryTimeoutTitle',
'admin.sql.queryTimeoutDescription',
'admin.sql.connMaxLifetimeTitle',
'admin.sql.connMaxLifetimeDescription',
'admin.sql.traceTitle',
'admin.sql.traceDescription',
],
isHidden: it.configIsTrue('ExperimentalSettings', 'RestrictSystemAdmin'),
isDisabled: it.not(it.userHasWritePermissionOnResource('environment')),
schema: {
id: 'DatabaseSettings',
component: DatabaseSettings,
},
},
elasticsearch: {
url: 'environment/elasticsearch',
title: t('admin.sidebar.elasticsearch'),
title_default: 'Elasticsearch',
isHidden: it.any(
it.not(it.licensedForFeature('Elasticsearch')),
it.configIsTrue('ExperimentalSettings', 'RestrictSystemAdmin'),
),
searchableStrings: [
'admin.elasticsearch.title',
'admin.elasticsearch.enableIndexingTitle',
['admin.elasticsearch.enableIndexingDescription', {documentationLink: ''}],
'admin.elasticsearch.enableIndexingDescription.documentationLinkText',
'admin.elasticsearch.connectionUrlTitle',
['admin.elasticsearch.connectionUrlDescription', {documentationLink: ''}],
'admin.elasticsearch.connectionUrlExample.documentationLinkText',
'admin.elasticsearch.skipTLSVerificationTitle',
'admin.elasticsearch.skipTLSVerificationDescription',
'admin.elasticsearch.usernameTitle',
'admin.elasticsearch.usernameDescription',
'admin.elasticsearch.passwordTitle',
'admin.elasticsearch.passwordDescription',
'admin.elasticsearch.sniffTitle',
'admin.elasticsearch.sniffDescription',
'admin.elasticsearch.testHelpText',
'admin.elasticsearch.elasticsearch_test_button',
'admin.elasticsearch.bulkIndexingTitle',
'admin.elasticsearch.createJob.help',
'admin.elasticsearch.purgeIndexesHelpText',
'admin.elasticsearch.purgeIndexesButton',
'admin.elasticsearch.purgeIndexesButton.label',
'admin.elasticsearch.enableSearchingTitle',
'admin.elasticsearch.enableSearchingDescription',
],
isDisabled: it.not(it.userHasWritePermissionOnResource('environment')),
schema: {
id: 'ElasticSearchSettings',
component: ElasticSearchSettings,
},
},
storage: {
url: 'environment/file_storage',
title: t('admin.sidebar.fileStorage'),
title_default: 'File Storage',
isHidden: it.configIsTrue('ExperimentalSettings', 'RestrictSystemAdmin'),
schema: {
id: 'FileSettings',
name: t('admin.environment.fileStorage'),
name_default: 'File Storage',
settings: [
{
type: Constants.SettingsTypes.TYPE_DROPDOWN,
key: 'FileSettings.DriverName',
label: t('admin.image.storeTitle'),
label_default: 'File Storage System:',
help_text: t('admin.image.storeDescription'),
help_text_default: 'Storage system where files and image attachments are saved.\n \nSelecting "Amazon S3" enables fields to enter your Amazon credentials and bucket details.\n \nSelecting "Local File System" enables the field to specify a local file directory.',
help_text_markdown: true,
options: [
{
value: FILE_STORAGE_DRIVER_LOCAL,
display_name: t('admin.image.storeLocal'),
display_name_default: 'Local File System',
},
{
value: FILE_STORAGE_DRIVER_S3,
display_name: t('admin.image.storeAmazonS3'),
display_name_default: 'Amazon S3',
},
],
isDisabled: it.not(it.userHasWritePermissionOnResource('environment')),
},
{
type: Constants.SettingsTypes.TYPE_TEXT,
key: 'FileSettings.Directory',
label: t('admin.image.localTitle'),
label_default: 'Local Storage Directory:',
help_text: t('admin.image.localDescription'),
help_text_default: 'Directory to which files and images are written. If blank, defaults to ./data/.',
placeholder: t('admin.image.localExample'),
placeholder_default: 'E.g.: "./data/"',
isDisabled: it.any(
it.not(it.userHasWritePermissionOnResource('environment')),
it.not(it.stateEquals('FileSettings.DriverName', FILE_STORAGE_DRIVER_LOCAL)),
),
},
{
type: Constants.SettingsTypes.TYPE_NUMBER,
key: 'FileSettings.MaxFileSize',
label: t('admin.image.maxFileSizeTitle'),
label_default: 'Maximum File Size:',
help_text: t('admin.image.maxFileSizeDescription'),
help_text_default: 'Maximum file size for message attachments in megabytes. Caution: Verify server memory can support your setting choice. Large file sizes increase the risk of server crashes and failed uploads due to network interruptions.',
placeholder: t('admin.image.maxFileSizeExample'),
placeholder_default: '50',
onConfigLoad: (configVal) => configVal / MEBIBYTE,
onConfigSave: (displayVal) => displayVal * MEBIBYTE,
isDisabled: it.not(it.userHasWritePermissionOnResource('environment')),
},
{
type: Constants.SettingsTypes.TYPE_TEXT,
key: 'FileSettings.AmazonS3Bucket',
label: t('admin.image.amazonS3BucketTitle'),
label_default: 'Amazon S3 Bucket:',
help_text: t('admin.image.amazonS3BucketDescription'),
help_text_default: 'Name you selected for your S3 bucket in AWS.',
placeholder: t('admin.image.amazonS3BucketExample'),
placeholder_default: 'E.g.: "mattermost-media"',
isDisabled: it.any(
it.not(it.userHasWritePermissionOnResource('environment')),
it.not(it.stateEquals('FileSettings.DriverName', FILE_STORAGE_DRIVER_S3)),
),
},
{
type: Constants.SettingsTypes.TYPE_TEXT,
key: 'FileSettings.AmazonS3PathPrefix',
label: t('admin.image.amazonS3PathPrefixTitle'),
label_default: 'Amazon S3 Path Prefix:',
help_text: t('admin.image.amazonS3PathPrefixDescription'),
help_text_default: 'Prefix you selected for your S3 bucket in AWS.',
placeholder: t('admin.image.amazonS3PathPrefixExample'),
placeholder_default: 'E.g.: "subdir1/" or you can leave it .',
isDisabled: it.not(it.stateEquals('FileSettings.DriverName', FILE_STORAGE_DRIVER_S3)),
},
{
type: Constants.SettingsTypes.TYPE_TEXT,
key: 'FileSettings.AmazonS3Region',
label: t('admin.image.amazonS3RegionTitle'),
label_default: 'Amazon S3 Region:',
help_text: t('admin.image.amazonS3RegionDescription'),
help_text_default: 'AWS region you selected when creating your S3 bucket. If no region is set, Mattermost attempts to get the appropriate region from AWS, or sets it to "us-east-1" if none found.',
placeholder: t('admin.image.amazonS3RegionExample'),
placeholder_default: 'E.g.: "us-east-1"',
isDisabled: it.any(
it.not(it.userHasWritePermissionOnResource('environment')),
it.not(it.stateEquals('FileSettings.DriverName', FILE_STORAGE_DRIVER_S3)),
),
},
{
type: Constants.SettingsTypes.TYPE_TEXT,
key: 'FileSettings.AmazonS3AccessKeyId',
label: t('admin.image.amazonS3IdTitle'),
label_default: 'Amazon S3 Access Key ID:',
help_text: t('admin.image.amazonS3IdDescription'),
help_text_markdown: true,
help_text_default: '(Optional) Only required if you do not want to authenticate to S3 using an [IAM role](!https://about.mattermost.com/default-iam-role). Enter the Access Key ID provided by your Amazon EC2 administrator.',
placeholder: t('admin.image.amazonS3IdExample'),
placeholder_default: 'E.g.: "AKIADTOVBGERKLCBV"',
isDisabled: it.any(
it.not(it.userHasWritePermissionOnResource('environment')),
it.not(it.stateEquals('FileSettings.DriverName', FILE_STORAGE_DRIVER_S3)),
),
},
{
type: Constants.SettingsTypes.TYPE_TEXT,
key: 'FileSettings.AmazonS3Endpoint',
label: t('admin.image.amazonS3EndpointTitle'),
label_default: 'Amazon S3 Endpoint:',
help_text: t('admin.image.amazonS3EndpointDescription'),
help_text_default: 'Hostname of your S3 Compatible Storage provider. Defaults to "s3.amazonaws.com".',
placeholder: t('admin.image.amazonS3EndpointExample'),
placeholder_default: 'E.g.: "s3.amazonaws.com"',
isDisabled: it.any(
it.not(it.userHasWritePermissionOnResource('environment')),
it.not(it.stateEquals('FileSettings.DriverName', FILE_STORAGE_DRIVER_S3)),
),
},
{
type: Constants.SettingsTypes.TYPE_TEXT,
key: 'FileSettings.AmazonS3SecretAccessKey',
label: t('admin.image.amazonS3SecretTitle'),
label_default: 'Amazon S3 Secret Access Key:',
help_text: t('admin.image.amazonS3SecretDescription'),
help_text_default: '(Optional) The secret access key associated with your Amazon S3 Access Key ID.',
placeholder: t('admin.image.amazonS3SecretExample'),
placeholder_default: 'E.g.: "jcuS8PuvcpGhpgHhlcpT1Mx42pnqMxQY"',
isDisabled: it.any(
it.not(it.userHasWritePermissionOnResource('environment')),
it.not(it.stateEquals('FileSettings.DriverName', FILE_STORAGE_DRIVER_S3)),
),
},
{
type: Constants.SettingsTypes.TYPE_BOOL,
key: 'FileSettings.AmazonS3SSL',
label: t('admin.image.amazonS3SSLTitle'),
label_default: 'Enable Secure Amazon S3 Connections:',
help_text: t('admin.image.amazonS3SSLDescription'),
help_text_default: 'When false, allow insecure connections to Amazon S3. Defaults to secure connections only.',
isDisabled: it.any(
it.not(it.userHasWritePermissionOnResource('environment')),
it.not(it.stateEquals('FileSettings.DriverName', FILE_STORAGE_DRIVER_S3)),
),
},
{
type: Constants.SettingsTypes.TYPE_BOOL,
key: 'FileSettings.AmazonS3SSE',
label: t('admin.image.amazonS3SSETitle'),
label_default: 'Enable Server-Side Encryption for Amazon S3:',
help_text: t('admin.image.amazonS3SSEDescription'),
help_text_markdown: true,
help_text_default: 'When true, encrypt files in Amazon S3 using server-side encryption with Amazon S3-managed keys. See [documentation](!https://about.mattermost.com/default-server-side-encryption) to learn more.',
isHidden: it.not(it.licensedForFeature('Compliance')),
isDisabled: it.any(
it.not(it.userHasWritePermissionOnResource('environment')),
it.not(it.stateEquals('FileSettings.DriverName', FILE_STORAGE_DRIVER_S3)),
),
},
{
type: Constants.SettingsTypes.TYPE_BOOL,
key: 'FileSettings.AmazonS3Trace',
label: t('admin.image.amazonS3TraceTitle'),
label_default: 'Enable Amazon S3 Debugging:',
help_text: t('admin.image.amazonS3TraceDescription'),
help_text_default: '(Development Mode) When true, log additional debugging information to the system logs.',
isDisabled: it.any(
it.not(it.userHasWritePermissionOnResource('environment')),
it.not(it.stateEquals('FileSettings.DriverName', FILE_STORAGE_DRIVER_S3)),
),
},
{
type: Constants.SettingsTypes.TYPE_BUTTON,