From 0f8605a765d723a6c7ec9406e9bbdb5a77fcdc19 Mon Sep 17 00:00:00 2001 From: Simon Pichugin Date: Jun 23 2020 17:28:59 +0000 Subject: Issue 50696 - Fix Allowed and Denied Ciphers lists - WebUI Description: When we add a cipher to an Allowed list we should not be allowed to add the same cipher to a Denied list. Also, show a warning when we do an action which requires a restart. https://pagure.io/389-ds-base/issue/50696 Reviewed by: mreynolds (Thanks!) --- diff --git a/src/cockpit/389-console/src/lib/database/databaseConfig.jsx b/src/cockpit/389-console/src/lib/database/databaseConfig.jsx index c1d35f4..f6e662b 100644 --- a/src/cockpit/389-console/src/lib/database/databaseConfig.jsx +++ b/src/cockpit/389-console/src/lib/database/databaseConfig.jsx @@ -184,10 +184,6 @@ export class GlobalDatabaseConfig extends React.Component { if (cmd.length > 6) { log_cmd("save_db_config", "Applying config change", cmd); let msg = "Successfully updated database configuration"; - if (requireRestart) { - msg = ("Successfully updated database configuration. These " + - "changes require the server to be restarted to take effect"); - } cockpit .spawn(cmd, {superuser: true, "err": "message"}) .done(content => { @@ -197,6 +193,12 @@ export class GlobalDatabaseConfig extends React.Component { "success", msg ); + if (requireRestart) { + this.props.addNotification( + "warning", + `You must restart the Directory Server for these changes to take effect.` + ); + } }) .fail(err => { let errMsg = JSON.parse(err); diff --git a/src/cockpit/389-console/src/lib/database/suffix.jsx b/src/cockpit/389-console/src/lib/database/suffix.jsx index 3558191..fd028cb 100644 --- a/src/cockpit/389-console/src/lib/database/suffix.jsx +++ b/src/cockpit/389-console/src/lib/database/suffix.jsx @@ -726,10 +726,6 @@ export class Suffix extends React.Component { if (cmd.length > 7) { log_cmd("saveSuffixConfig", "Save suffix config", cmd); let msg = "Successfully updated suffix configuration"; - if (requireRestart) { - msg = ("Successfully updated suffix configuration. These " + - "changes require the server to be restarted to take effect"); - } cockpit .spawn(cmd, {superuser: true, "err": "message"}) .done(content => { @@ -739,6 +735,12 @@ export class Suffix extends React.Component { "success", msg ); + if (requireRestart) { + this.props.addNotification( + "warning", + `You must restart the Directory Server for these changes to take effect.` + ); + } }) .fail(err => { let errMsg = JSON.parse(err); diff --git a/src/cockpit/389-console/src/lib/security/ciphers.jsx b/src/cockpit/389-console/src/lib/security/ciphers.jsx index c54cb09..84b0100 100644 --- a/src/cockpit/389-console/src/lib/security/ciphers.jsx +++ b/src/cockpit/389-console/src/lib/security/ciphers.jsx @@ -111,7 +111,11 @@ export class Ciphers extends React.Component { .done(() => { this.props.addNotification( "success", - `Successfully set cipher preferences. You must restart the Directory Server for these changes to take effect.` + `Successfully set cipher preferences.` + ); + this.props.addNotification( + "warning", + `You must restart the Directory Server for these changes to take effect.` ); this.setState({ saving: false, @@ -140,7 +144,7 @@ export class Ciphers extends React.Component { } handleCipherChange (type, values) { - let availableCiphers = this.props.supportedCiphers.slice(0); // Copy array + let availableCiphers = this.state.availableCiphers.slice(0); // Copy array for (let i = 0; i < availableCiphers.length; i++) { for (let ci = 0; ci < values.length; ci++) { if (availableCiphers[i] === values[ci]) { diff --git a/src/cockpit/389-console/src/security.jsx b/src/cockpit/389-console/src/security.jsx index 1b56e04..a922f67 100644 --- a/src/cockpit/389-console/src/security.jsx +++ b/src/cockpit/389-console/src/security.jsx @@ -412,7 +412,11 @@ export class Security extends React.Component { .done(() => { this.props.addNotification( "success", - `Successfully enabled security. You must restart the server for this to take effect.` + `Successfully enabled security.` + ); + this.props.addNotification( + "warning", + `You must restart the Directory Server for these changes to take effect.` ); this.setState({ securityEnabled: true, @@ -448,7 +452,11 @@ export class Security extends React.Component { .done(() => { this.props.addNotification( "success", - `Successfully disabled security. You must restart the server for this to take effect.` + `Successfully disabled security.` + ); + this.props.addNotification( + "warning", + `You must restart the Directory Server for these changes to take effect.` ); this.setState({ securityEnabled: false, @@ -540,7 +548,7 @@ export class Security extends React.Component { if (cmd.length > 5) { log_cmd("saveSecurityConfig", "Applying security config change", cmd); - let msg = "Successfully updated security configuration. You must restart the Directory Server for these changes to take effect."; + let msg = "Successfully updated security configuration."; this.setState({ // Start the spinner @@ -555,6 +563,10 @@ export class Security extends React.Component { "success", msg ); + this.props.addNotification( + "warning", + `You must restart the Directory Server for these changes to take effect.` + ); this.setState({ saving: false });