[MM-54594] Adding new global relay type (#24672)
* adding new global relay type, custom
Этот коммит содержится в:
@@ -630,6 +630,8 @@ const defaultServerConfig: AdminConfig = {
|
|||||||
SMTPPassword: '',
|
SMTPPassword: '',
|
||||||
EmailAddress: '',
|
EmailAddress: '',
|
||||||
SMTPServerTimeout: 1800,
|
SMTPServerTimeout: 1800,
|
||||||
|
CustomSMTPServerName: '',
|
||||||
|
CustomSMTPPort: '25',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
JobSettings: {
|
JobSettings: {
|
||||||
|
|||||||
@@ -8848,7 +8848,11 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "model.config.is_valid.message_export.global_relay.customer_type.app_error",
|
"id": "model.config.is_valid.message_export.global_relay.customer_type.app_error",
|
||||||
"translation": "Message export GlobalRelaySettings.CustomerType must be set to one of either 'A9' or 'A10'."
|
"translation": "Message export GlobalRelaySettings.CustomerType must be set to one of either 'A9', 'A10' or 'CUSTOM."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "model.config.is_valid.message_export.global_relay.customer_type_custom.app_error",
|
||||||
|
"translation": "If GlobalRelaySettings.CustomerType is 'CUSTOM', then GlobalRelaySettings.CustomSMTPServerName and GlobalRelaySettings.CustomSMTPPort must be set."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "model.config.is_valid.message_export.global_relay.email_address.app_error",
|
"id": "model.config.is_valid.message_export.global_relay.email_address.app_error",
|
||||||
|
|||||||
@@ -226,6 +226,7 @@ const (
|
|||||||
ComplianceExportTypeGlobalrelayZip = "globalrelay-zip"
|
ComplianceExportTypeGlobalrelayZip = "globalrelay-zip"
|
||||||
GlobalrelayCustomerTypeA9 = "A9"
|
GlobalrelayCustomerTypeA9 = "A9"
|
||||||
GlobalrelayCustomerTypeA10 = "A10"
|
GlobalrelayCustomerTypeA10 = "A10"
|
||||||
|
GlobalrelayCustomerTypeCustom = "CUSTOM"
|
||||||
|
|
||||||
ClientSideCertCheckPrimaryAuth = "primary"
|
ClientSideCertCheckPrimaryAuth = "primary"
|
||||||
ClientSideCertCheckSecondaryAuth = "secondary"
|
ClientSideCertCheckSecondaryAuth = "secondary"
|
||||||
@@ -3108,11 +3109,13 @@ func (s *PluginSettings) SetDefaults(ls LogSettings) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type GlobalRelayMessageExportSettings struct {
|
type GlobalRelayMessageExportSettings struct {
|
||||||
CustomerType *string `access:"compliance_compliance_export"` // must be either A9 or A10, dictates SMTP server url
|
CustomerType *string `access:"compliance_compliance_export"` // must be either A9, A10 or CUSTOM, dictates SMTP server url
|
||||||
SMTPUsername *string `access:"compliance_compliance_export"`
|
SMTPUsername *string `access:"compliance_compliance_export"`
|
||||||
SMTPPassword *string `access:"compliance_compliance_export"`
|
SMTPPassword *string `access:"compliance_compliance_export"`
|
||||||
EmailAddress *string `access:"compliance_compliance_export"` // the address to send messages to
|
EmailAddress *string `access:"compliance_compliance_export"` // the address to send messages to
|
||||||
SMTPServerTimeout *int `access:"compliance_compliance_export"`
|
SMTPServerTimeout *int `access:"compliance_compliance_export"`
|
||||||
|
CustomSMTPServerName *string `access:"compliance_compliance_export"`
|
||||||
|
CustomSMTPPort *string `access:"compliance_compliance_export"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *GlobalRelayMessageExportSettings) SetDefaults() {
|
func (s *GlobalRelayMessageExportSettings) SetDefaults() {
|
||||||
@@ -3131,6 +3134,12 @@ func (s *GlobalRelayMessageExportSettings) SetDefaults() {
|
|||||||
if s.SMTPServerTimeout == nil || *s.SMTPServerTimeout == 0 {
|
if s.SMTPServerTimeout == nil || *s.SMTPServerTimeout == 0 {
|
||||||
s.SMTPServerTimeout = NewInt(1800)
|
s.SMTPServerTimeout = NewInt(1800)
|
||||||
}
|
}
|
||||||
|
if s.CustomSMTPServerName == nil {
|
||||||
|
s.CustomSMTPServerName = NewString("")
|
||||||
|
}
|
||||||
|
if s.CustomSMTPPort == nil {
|
||||||
|
s.CustomSMTPPort = NewString("25")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type MessageExportSettings struct {
|
type MessageExportSettings struct {
|
||||||
@@ -4105,8 +4114,10 @@ func (s *MessageExportSettings) isValid() *AppError {
|
|||||||
if *s.ExportFormat == ComplianceExportTypeGlobalrelay {
|
if *s.ExportFormat == ComplianceExportTypeGlobalrelay {
|
||||||
if s.GlobalRelaySettings == nil {
|
if s.GlobalRelaySettings == nil {
|
||||||
return NewAppError("Config.IsValid", "model.config.is_valid.message_export.global_relay.config_missing.app_error", nil, "", http.StatusBadRequest)
|
return NewAppError("Config.IsValid", "model.config.is_valid.message_export.global_relay.config_missing.app_error", nil, "", http.StatusBadRequest)
|
||||||
} else if s.GlobalRelaySettings.CustomerType == nil || (*s.GlobalRelaySettings.CustomerType != GlobalrelayCustomerTypeA9 && *s.GlobalRelaySettings.CustomerType != GlobalrelayCustomerTypeA10) {
|
} else if s.GlobalRelaySettings.CustomerType == nil || (*s.GlobalRelaySettings.CustomerType != GlobalrelayCustomerTypeA9 && *s.GlobalRelaySettings.CustomerType != GlobalrelayCustomerTypeA10 && *s.GlobalRelaySettings.CustomerType != GlobalrelayCustomerTypeCustom) {
|
||||||
return NewAppError("Config.IsValid", "model.config.is_valid.message_export.global_relay.customer_type.app_error", nil, "", http.StatusBadRequest)
|
return NewAppError("Config.IsValid", "model.config.is_valid.message_export.global_relay.customer_type.app_error", nil, "", http.StatusBadRequest)
|
||||||
|
} else if *s.GlobalRelaySettings.CustomerType == GlobalrelayCustomerTypeCustom && ((s.GlobalRelaySettings.CustomSMTPServerName == nil || *s.GlobalRelaySettings.CustomSMTPServerName == "") || (s.GlobalRelaySettings.CustomSMTPPort == nil || *s.GlobalRelaySettings.CustomSMTPPort == "")) {
|
||||||
|
return NewAppError("Config.IsValid", "model.config.is_valid.message_export.global_relay.customer_type_custom.app_error", nil, "", http.StatusBadRequest)
|
||||||
} else if s.GlobalRelaySettings.EmailAddress == nil || !strings.Contains(*s.GlobalRelaySettings.EmailAddress, "@") {
|
} else if s.GlobalRelaySettings.EmailAddress == nil || !strings.Contains(*s.GlobalRelaySettings.EmailAddress, "@") {
|
||||||
// validating email addresses is hard - just make sure it contains an '@' sign
|
// validating email addresses is hard - just make sure it contains an '@' sign
|
||||||
// see https://stackoverflow.com/questions/201323/using-a-regular-expression-to-validate-an-email-address
|
// see https://stackoverflow.com/questions/201323/using-a-regular-expression-to-validate-an-email-address
|
||||||
|
|||||||
@@ -316,6 +316,10 @@ exports[`components/MessageExportSettings should match snapshot, disabled, globa
|
|||||||
"text": "A10/Type 10",
|
"text": "A10/Type 10",
|
||||||
"value": "A10",
|
"value": "A10",
|
||||||
},
|
},
|
||||||
|
Object {
|
||||||
|
"text": "Custom",
|
||||||
|
"value": "CUSTOM",
|
||||||
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
@@ -757,6 +761,10 @@ exports[`components/MessageExportSettings should match snapshot, enabled, global
|
|||||||
"text": "A10/Type 10",
|
"text": "A10/Type 10",
|
||||||
"value": "A10",
|
"value": "A10",
|
||||||
},
|
},
|
||||||
|
Object {
|
||||||
|
"text": "Custom",
|
||||||
|
"value": "CUSTOM",
|
||||||
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -82,6 +82,8 @@ describe('components/MessageExportSettings', () => {
|
|||||||
SMTPUsername: 'globalRelayUser',
|
SMTPUsername: 'globalRelayUser',
|
||||||
SMTPPassword: 'globalRelayPassword',
|
SMTPPassword: 'globalRelayPassword',
|
||||||
EmailAddress: 'globalRelay@mattermost.com',
|
EmailAddress: 'globalRelay@mattermost.com',
|
||||||
|
CustomSMTPServerName: '',
|
||||||
|
CustomSMTPPort: '25',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@@ -126,6 +128,8 @@ describe('components/MessageExportSettings', () => {
|
|||||||
SMTPUsername: 'globalRelayUser',
|
SMTPUsername: 'globalRelayUser',
|
||||||
SMTPPassword: 'globalRelayPassword',
|
SMTPPassword: 'globalRelayPassword',
|
||||||
EmailAddress: 'globalRelay@mattermost.com',
|
EmailAddress: 'globalRelay@mattermost.com',
|
||||||
|
CustomSMTPServerName: '',
|
||||||
|
CustomSMTPPort: '25',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ interface State extends BaseState {
|
|||||||
globalRelaySMTPUsername: AdminConfig['MessageExportSettings']['GlobalRelaySettings']['SMTPUsername'];
|
globalRelaySMTPUsername: AdminConfig['MessageExportSettings']['GlobalRelaySettings']['SMTPUsername'];
|
||||||
globalRelaySMTPPassword: AdminConfig['MessageExportSettings']['GlobalRelaySettings']['SMTPPassword'];
|
globalRelaySMTPPassword: AdminConfig['MessageExportSettings']['GlobalRelaySettings']['SMTPPassword'];
|
||||||
globalRelayEmailAddress: AdminConfig['MessageExportSettings']['GlobalRelaySettings']['EmailAddress'];
|
globalRelayEmailAddress: AdminConfig['MessageExportSettings']['GlobalRelaySettings']['EmailAddress'];
|
||||||
|
globalRelayCustomSMTPServerName: AdminConfig['MessageExportSettings']['GlobalRelaySettings']['CustomSMTPServerName'];
|
||||||
|
globalRelayCustomSMTPPort: AdminConfig['MessageExportSettings']['GlobalRelaySettings']['CustomSMTPPort'];
|
||||||
globalRelaySMTPServerTimeout: AdminConfig['MessageExportSettings']['GlobalRelaySettings']['SMTPServerTimeout'];
|
globalRelaySMTPServerTimeout: AdminConfig['MessageExportSettings']['GlobalRelaySettings']['SMTPServerTimeout'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,6 +49,8 @@ export default class MessageExportSettings extends AdminSettings<BaseProps, Stat
|
|||||||
SMTPUsername: this.state.globalRelaySMTPUsername,
|
SMTPUsername: this.state.globalRelaySMTPUsername,
|
||||||
SMTPPassword: this.state.globalRelaySMTPPassword,
|
SMTPPassword: this.state.globalRelaySMTPPassword,
|
||||||
EmailAddress: this.state.globalRelayEmailAddress,
|
EmailAddress: this.state.globalRelayEmailAddress,
|
||||||
|
CustomSMTPServerName: this.state.globalRelayCustomSMTPServerName,
|
||||||
|
CustomSMTPPort: this.state.globalRelayCustomSMTPPort,
|
||||||
SMTPServerTimeout: this.state.globalRelaySMTPServerTimeout,
|
SMTPServerTimeout: this.state.globalRelaySMTPServerTimeout,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -63,6 +67,8 @@ export default class MessageExportSettings extends AdminSettings<BaseProps, Stat
|
|||||||
globalRelaySMTPPassword: '',
|
globalRelaySMTPPassword: '',
|
||||||
globalRelayEmailAddress: '',
|
globalRelayEmailAddress: '',
|
||||||
globalRelaySMTPServerTimeout: 0,
|
globalRelaySMTPServerTimeout: 0,
|
||||||
|
globalRelayCustomSMTPServerName: '',
|
||||||
|
globalRelayCustomSMTPPort: '',
|
||||||
saveNeeded: false,
|
saveNeeded: false,
|
||||||
saving: false,
|
saving: false,
|
||||||
serverError: null,
|
serverError: null,
|
||||||
@@ -73,6 +79,8 @@ export default class MessageExportSettings extends AdminSettings<BaseProps, Stat
|
|||||||
state.globalRelaySMTPUsername = config.MessageExportSettings.GlobalRelaySettings.SMTPUsername;
|
state.globalRelaySMTPUsername = config.MessageExportSettings.GlobalRelaySettings.SMTPUsername;
|
||||||
state.globalRelaySMTPPassword = config.MessageExportSettings.GlobalRelaySettings.SMTPPassword;
|
state.globalRelaySMTPPassword = config.MessageExportSettings.GlobalRelaySettings.SMTPPassword;
|
||||||
state.globalRelayEmailAddress = config.MessageExportSettings.GlobalRelaySettings.EmailAddress;
|
state.globalRelayEmailAddress = config.MessageExportSettings.GlobalRelaySettings.EmailAddress;
|
||||||
|
state.globalRelayCustomSMTPServerName = config.MessageExportSettings.GlobalRelaySettings.CustomSMTPServerName;
|
||||||
|
state.globalRelayCustomSMTPPort = config.MessageExportSettings.GlobalRelaySettings.CustomSMTPPort;
|
||||||
}
|
}
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
@@ -148,6 +156,7 @@ export default class MessageExportSettings extends AdminSettings<BaseProps, Stat
|
|||||||
values={[
|
values={[
|
||||||
{value: 'A9', text: Utils.localizeMessage('admin.complianceExport.globalRelayCustomerType.a9.description', 'A9/Type 9')},
|
{value: 'A9', text: Utils.localizeMessage('admin.complianceExport.globalRelayCustomerType.a9.description', 'A9/Type 9')},
|
||||||
{value: 'A10', text: Utils.localizeMessage('admin.complianceExport.globalRelayCustomerType.a10.description', 'A10/Type 10')},
|
{value: 'A10', text: Utils.localizeMessage('admin.complianceExport.globalRelayCustomerType.a10.description', 'A10/Type 10')},
|
||||||
|
{value: 'CUSTOM', text: Utils.localizeMessage('admin.complianceExport.globalRelayCustomerType.custom.description', 'Custom')},
|
||||||
]}
|
]}
|
||||||
label={
|
label={
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
@@ -237,12 +246,66 @@ export default class MessageExportSettings extends AdminSettings<BaseProps, Stat
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const globalRelaySMTPServerName = (
|
||||||
|
<TextSetting
|
||||||
|
id='globalRelayCustomSMTPServerName'
|
||||||
|
label={
|
||||||
|
<FormattedMessage
|
||||||
|
id='admin.complianceExport.globalRelayCustomSMTPServerName.title'
|
||||||
|
defaultMessage='SMTP Server Name:'
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
placeholder={Utils.localizeMessage('admin.complianceExport.globalRelayCustomSMTPServerName.example', 'E.g.: "feeds.globalrelay.com"')}
|
||||||
|
helpText={
|
||||||
|
<FormattedMessage
|
||||||
|
id='admin.complianceExport.globalRelayCustomSMTPServerName.description'
|
||||||
|
defaultMessage='The SMTP server name that will receive your Global Relay EML.'
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
value={this.state.globalRelayCustomSMTPServerName ? this.state.globalRelayCustomSMTPServerName : ''}
|
||||||
|
onChange={this.handleChange}
|
||||||
|
setByEnv={this.isSetByEnv('DataRetentionSettings.GlobalRelaySettings.CustomSMTPServerName')}
|
||||||
|
disabled={this.props.isDisabled || !this.state.enableComplianceExport}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
|
||||||
|
const globalRelaySMTPPort = (
|
||||||
|
<TextSetting
|
||||||
|
id='globalRelayCustomSMTPPort'
|
||||||
|
label={
|
||||||
|
<FormattedMessage
|
||||||
|
id='admin.complianceExport.globalRelayCustomSMTPPort.title'
|
||||||
|
defaultMessage='SMTP Server Port:'
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
placeholder={Utils.localizeMessage('admin.complianceExport.globalRelayCustomSMTPPort.example', 'E.g.: "25"')}
|
||||||
|
helpText={
|
||||||
|
<FormattedMessage
|
||||||
|
id='admin.complianceExport.globalRelayCustomSMTPPort.description'
|
||||||
|
defaultMessage='The SMTP server port that will receive your Global Relay EML.'
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
value={this.state.globalRelayCustomSMTPPort ? this.state.globalRelayCustomSMTPPort : ''}
|
||||||
|
onChange={this.handleChange}
|
||||||
|
setByEnv={this.isSetByEnv('DataRetentionSettings.GlobalRelaySettings.CustomSMTPPort')}
|
||||||
|
disabled={this.props.isDisabled || !this.state.enableComplianceExport}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
|
||||||
globalRelaySettings = (
|
globalRelaySettings = (
|
||||||
<SettingsGroup id={'globalRelaySettings'} >
|
<SettingsGroup id={'globalRelaySettings'} >
|
||||||
{globalRelayCustomerType}
|
{globalRelayCustomerType}
|
||||||
{globalRelaySMTPUsername}
|
{globalRelaySMTPUsername}
|
||||||
{globalRelaySMTPPassword}
|
{globalRelaySMTPPassword}
|
||||||
{globalRelayEmail}
|
{globalRelayEmail}
|
||||||
|
{
|
||||||
|
this.state.globalRelayCustomerType === 'CUSTOM' &&
|
||||||
|
globalRelaySMTPServerName
|
||||||
|
}
|
||||||
|
{
|
||||||
|
this.state.globalRelayCustomerType === 'CUSTOM' &&
|
||||||
|
globalRelaySMTPPort
|
||||||
|
}
|
||||||
</SettingsGroup>
|
</SettingsGroup>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -607,8 +607,15 @@
|
|||||||
"admin.complianceExport.exportJobStartTime.title": "Compliance Export time:",
|
"admin.complianceExport.exportJobStartTime.title": "Compliance Export time:",
|
||||||
"admin.complianceExport.globalRelayCustomerType.a10.description": "A10/Type 10",
|
"admin.complianceExport.globalRelayCustomerType.a10.description": "A10/Type 10",
|
||||||
"admin.complianceExport.globalRelayCustomerType.a9.description": "A9/Type 9",
|
"admin.complianceExport.globalRelayCustomerType.a9.description": "A9/Type 9",
|
||||||
|
"admin.complianceExport.globalRelayCustomerType.custom.description": "Custom",
|
||||||
"admin.complianceExport.globalRelayCustomerType.description": "Type of Global Relay customer account your organization has.",
|
"admin.complianceExport.globalRelayCustomerType.description": "Type of Global Relay customer account your organization has.",
|
||||||
"admin.complianceExport.globalRelayCustomerType.title": "Global Relay Customer Account:",
|
"admin.complianceExport.globalRelayCustomerType.title": "Global Relay Customer Account:",
|
||||||
|
"admin.complianceExport.globalRelayCustomSMTPPort.description": "The SMTP server port that will receive your Global Relay EML.",
|
||||||
|
"admin.complianceExport.globalRelayCustomSMTPPort.example": "E.g.: \"25\"",
|
||||||
|
"admin.complianceExport.globalRelayCustomSMTPPort.title": "SMTP Server Port:",
|
||||||
|
"admin.complianceExport.globalRelayCustomSMTPServerName.description": "The SMTP server name that will receive your Global Relay EML.",
|
||||||
|
"admin.complianceExport.globalRelayCustomSMTPServerName.example": "E.g.: \"feeds.globalrelay.com\"",
|
||||||
|
"admin.complianceExport.globalRelayCustomSMTPServerName.title": "SMTP Server Name:",
|
||||||
"admin.complianceExport.globalRelayEmailAddress.description": "The email address your Global Relay server monitors for incoming compliance exports.",
|
"admin.complianceExport.globalRelayEmailAddress.description": "The email address your Global Relay server monitors for incoming compliance exports.",
|
||||||
"admin.complianceExport.globalRelayEmailAddress.example": "E.g.: \"globalrelay@mattermost.com\"",
|
"admin.complianceExport.globalRelayEmailAddress.example": "E.g.: \"globalrelay@mattermost.com\"",
|
||||||
"admin.complianceExport.globalRelayEmailAddress.title": "Global Relay Email Address:",
|
"admin.complianceExport.globalRelayEmailAddress.title": "Global Relay Email Address:",
|
||||||
|
|||||||
@@ -833,6 +833,8 @@ export type MessageExportSettings = {
|
|||||||
SMTPPassword: string;
|
SMTPPassword: string;
|
||||||
EmailAddress: string;
|
EmailAddress: string;
|
||||||
SMTPServerTimeout: number;
|
SMTPServerTimeout: number;
|
||||||
|
CustomSMTPServerName: string;
|
||||||
|
CustomSMTPPort: string;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user