Unverified Commit 98c7fa88 authored by Corey Hulen's avatar Corey Hulen Committed by GitHub
Browse files

PLT-5813 adding SAML sync settings to System Console (#207)

* PLT-5813 adding SAML sync settings to System Console

* PLT-5813 adding SAML sync option

* Update ldap_settings.jsx

* Update saml_settings.jsx

* Update en.json

* Fix build failure

* Update saml_settings.jsx

* Update en.json
parent 942588d8
......@@ -27,6 +27,7 @@ export default class LdapSettings extends AdminSettings {
getConfigFromState(config) {
config.LdapSettings.Enable = this.state.enable;
config.LdapSettings.EnableSync = this.state.enableSync;
config.LdapSettings.LdapServer = this.state.ldapServer;
config.LdapSettings.LdapPort = this.parseIntNonZero(this.state.ldapPort);
config.LdapSettings.ConnectionSecurity = this.state.connectionSecurity;
......@@ -53,6 +54,7 @@ export default class LdapSettings extends AdminSettings {
getStateFromConfig(config) {
return {
enable: config.LdapSettings.Enable,
enableSync: config.LdapSettings.EnableSync,
ldapServer: config.LdapSettings.LdapServer,
ldapPort: config.LdapSettings.LdapPort,
connectionSecurity: config.LdapSettings.ConnectionSecurity,
......@@ -84,6 +86,10 @@ export default class LdapSettings extends AdminSettings {
);
}
shouldBeDisabled = () => {
return !(this.state.enable || this.state.enableSync);
}
renderJobData(job) {
let mattermostUsers = '0';
let ldapUsers = '0';
......@@ -147,6 +153,23 @@ export default class LdapSettings extends AdminSettings {
value={this.state.enable}
onChange={this.handleChange}
/>
<BooleanSetting
id='enableSync'
label={
<FormattedMessage
id='admin.ldap.enableSyncTitle'
defaultMessage='Enable Synchronization with AD/LDAP:'
/>
}
helpText={
<FormattedMessage
id='admin.ldap.enableSyncDesc'
defaultMessage='When true, Mattermost periodically synchronizes users from AD/LDAP.'
/>
}
value={this.state.enableSync}
onChange={this.handleChange}
/>
<TextSetting
id='ldapServer'
label={
......@@ -164,7 +187,7 @@ export default class LdapSettings extends AdminSettings {
}
value={this.state.ldapServer}
onChange={this.handleChange}
disabled={!this.state.enable}
disabled={this.shouldBeDisabled()}
/>
<TextSetting
id='ldapPort'
......@@ -183,12 +206,12 @@ export default class LdapSettings extends AdminSettings {
}
value={this.state.ldapPort}
onChange={this.handleChange}
disabled={!this.state.enable}
disabled={this.shouldBeDisabled()}
/>
<ConnectionSecurityDropdownSettingLdap
value={this.state.connectionSecurity}
onChange={this.handleChange}
disabled={!this.state.enable}
disabled={this.shouldBeDisabled()}
/>
<BooleanSetting
id='skipCertificateVerification'
......@@ -224,7 +247,7 @@ export default class LdapSettings extends AdminSettings {
}
value={this.state.baseDN}
onChange={this.handleChange}
disabled={!this.state.enable}
disabled={this.shouldBeDisabled()}
/>
<TextSetting
id='bindUsername'
......@@ -242,7 +265,7 @@ export default class LdapSettings extends AdminSettings {
}
value={this.state.bindUsername}
onChange={this.handleChange}
disabled={!this.state.enable}
disabled={this.shouldBeDisabled()}
/>
<TextSetting
id='bindPassword'
......@@ -260,7 +283,7 @@ export default class LdapSettings extends AdminSettings {
}
value={this.state.bindPassword}
onChange={this.handleChange}
disabled={!this.state.enable}
disabled={this.shouldBeDisabled()}
/>
<TextSetting
id='userFilter'
......@@ -279,7 +302,7 @@ export default class LdapSettings extends AdminSettings {
}
value={this.state.userFilter}
onChange={this.handleChange}
disabled={!this.state.enable}
disabled={this.shouldBeDisabled()}
/>
<TextSetting
id='firstNameAttribute'
......@@ -298,7 +321,7 @@ export default class LdapSettings extends AdminSettings {
}
value={this.state.firstNameAttribute}
onChange={this.handleChange}
disabled={!this.state.enable}
disabled={this.shouldBeDisabled()}
/>
<TextSetting
id='lastNameAttribute'
......@@ -317,7 +340,7 @@ export default class LdapSettings extends AdminSettings {
}
value={this.state.lastNameAttribute}
onChange={this.handleChange}
disabled={!this.state.enable}
disabled={this.shouldBeDisabled()}
/>
<TextSetting
id='nicknameAttribute'
......@@ -336,7 +359,7 @@ export default class LdapSettings extends AdminSettings {
}
value={this.state.nicknameAttribute}
onChange={this.handleChange}
disabled={!this.state.enable}
disabled={this.shouldBeDisabled()}
/>
<TextSetting
id='positionAttribute'
......@@ -355,7 +378,7 @@ export default class LdapSettings extends AdminSettings {
}
value={this.state.positionAttribute}
onChange={this.handleChange}
disabled={!this.state.enable}
disabled={this.shouldBeDisabled()}
/>
<TextSetting
id='emailAttribute'
......@@ -374,7 +397,7 @@ export default class LdapSettings extends AdminSettings {
}
value={this.state.emailAttribute}
onChange={this.handleChange}
disabled={!this.state.enable}
disabled={this.shouldBeDisabled()}
/>
<TextSetting
id='usernameAttribute'
......@@ -393,7 +416,7 @@ export default class LdapSettings extends AdminSettings {
}
value={this.state.usernameAttribute}
onChange={this.handleChange}
disabled={!this.state.enable}
disabled={this.shouldBeDisabled()}
/>
<TextSetting
id='idAttribute'
......@@ -412,7 +435,7 @@ export default class LdapSettings extends AdminSettings {
}
value={this.state.idAttribute}
onChange={this.handleChange}
disabled={!this.state.enable}
disabled={this.shouldBeDisabled()}
/>
<TextSetting
id='loginFieldName'
......@@ -431,7 +454,7 @@ export default class LdapSettings extends AdminSettings {
}
value={this.state.loginFieldName}
onChange={this.handleChange}
disabled={!this.state.enable}
disabled={this.shouldBeDisabled()}
/>
<TextSetting
id='syncIntervalMinutes'
......@@ -449,7 +472,7 @@ export default class LdapSettings extends AdminSettings {
}
value={this.state.syncIntervalMinutes}
onChange={this.handleChange}
disabled={!this.state.enable}
disabled={this.shouldBeDisabled()}
/>
<TextSetting
id='maxPageSize'
......@@ -468,7 +491,7 @@ export default class LdapSettings extends AdminSettings {
}
value={this.state.maxPageSize}
onChange={this.handleChange}
disabled={!this.state.enable}
disabled={this.shouldBeDisabled()}
/>
<TextSetting
id='queryTimeout'
......@@ -487,7 +510,7 @@ export default class LdapSettings extends AdminSettings {
}
value={this.state.queryTimeout}
onChange={this.handleChange}
disabled={!this.state.enable}
disabled={this.shouldBeDisabled()}
/>
<RequestButton
requestAction={ldapTest}
......@@ -503,7 +526,7 @@ export default class LdapSettings extends AdminSettings {
defaultMessage='AD/LDAP Test'
/>
}
disabled={!this.state.enable}
disabled={this.shouldBeDisabled()}
saveNeeded={this.state.saveNeeded}
saveConfigAction={this.doSubmit}
errorMessage={{
......@@ -518,7 +541,7 @@ export default class LdapSettings extends AdminSettings {
<JobsTable
jobType={JobTypes.LDAP_SYNC}
getExtraInfoText={this.renderJobData}
disabled={!this.state.enable}
disabled={this.shouldBeDisabled()}
createJobButtonText={
<FormattedMessage
id='admin.ldap.sync_button'
......
......@@ -28,6 +28,7 @@ export default class SamlSettings extends AdminSettings {
getConfigFromState(config) {
config.SamlSettings.Enable = this.state.enable;
config.SamlSettings.EnableSyncWithLdap = this.state.enableSyncWithLdap;
config.SamlSettings.Verify = this.state.verify;
config.SamlSettings.Encrypt = this.state.encrypt;
config.SamlSettings.IdpUrl = this.state.idpUrl;
......@@ -61,6 +62,7 @@ export default class SamlSettings extends AdminSettings {
return {
siteUrlSet: siteUrl.length > 0,
enable: settings.Enable,
enableSyncWithLdap: settings.EnableSyncWithLdap,
verify: settings.Verify,
encrypt: settings.Encrypt,
idpUrl: settings.IdpUrl,
......@@ -354,6 +356,24 @@ export default class SamlSettings extends AdminSettings {
value={this.state.enable}
onChange={this.handleChange}
/>
<BooleanSetting
id='enableSyncWithLdap'
label={
<FormattedMessage
id='admin.saml.enableSyncWithLdapTitle'
defaultMessage='Enable Synchronizing SAML Accounts With AD/LDAP:'
/>
}
helpText={
<FormattedHTMLMessage
id='admin.saml.enableSyncWithLdapDescription'
defaultMessage='When true, Mattermost periodically synchronizes SAML user attributes, including user deactivation and removal, from AD/LDAP. Enable and configure synchronization settings at <strong>Authentication > AD/LDAP</strong>. See <a href="https://about.mattermost.com/default-saml-ldap-sync" target="_blank">documentation</a> to learn more.'
/>
}
value={this.state.enableSyncWithLdap}
onChange={this.handleChange}
disabled={!this.state.enable}
/>
<TextSetting
id='idpUrl'
label={
......
......@@ -549,6 +549,8 @@
"admin.ldap.emailAttrTitle": "Email Attribute:",
"admin.ldap.enableDesc": "When true, Mattermost allows login using AD/LDAP",
"admin.ldap.enableTitle": "Enable sign-in with AD/LDAP:",
"admin.ldap.enableSyncDesc": "When true, Mattermost periodically synchronizes users from AD/LDAP.",
"admin.ldap.enableSyncTitle": "Enable Synchronization with AD/LDAP:",
"admin.ldap.firstnameAttrDesc": "(Optional) The attribute in the AD/LDAP server that will be used to populate the first name of users in Mattermost. When set, users will not be able to edit their first name, since it is synchronized with the LDAP server. When left blank, users can set their own first name in Account Settings.",
"admin.ldap.firstnameAttrEx": "E.g.: \"givenName\"",
"admin.ldap.firstnameAttrTitle": "First Name Attribute",
......@@ -785,6 +787,8 @@
"admin.saml.emailAttrTitle": "Email Attribute:",
"admin.saml.enableDescription": "When true, Mattermost allows login using SAML 2.0. Please see <a href='http://docs.mattermost.com/deployment/sso-saml.html' target='_blank'>documentation</a> to learn more about configuring SAML for Mattermost.",
"admin.saml.enableTitle": "Enable Login With SAML 2.0:",
"admin.saml.enableSyncWithLdapDescription": "When true, Mattermost periodically synchronizes SAML user attributes, including user deactivation and removal, from AD/LDAP. Enable and configure synchronization settings at <strong>Authentication > AD/LDAP</strong>. See <a href='https://about.mattermost.com/default-saml-ldap-sync' target='_blank'>documentation</a> to learn more.",
"admin.saml.enableSyncWithLdapTitle": "Enable Synchronizing SAML Accounts With AD/LDAP:",
"admin.saml.encryptDescription": "When false, Mattermost will not decrypt SAML Assertions encrypted with your Service Provider Public Certificate. Not recommended for production environments. For testing only.",
"admin.saml.encryptTitle": "Enable Encryption:",
"admin.saml.firstnameAttrDesc": "(Optional) The attribute in the SAML Assertion that will be used to populate the first name of users in Mattermost.",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment