#50697 Issue 50696 - Fix various UI bugs
Closed 3 years ago by spichugi. Opened 4 years ago by mreynolds.
mreynolds/389-ds-base ui_fixes  into  master

@@ -212,8 +212,8 @@ 

          cockpit

                  .spawn(cmd, { superuser: true, err: "message" })

                  .done(content => {

-                     const config = JSON.parse(content);

-                     const availableOids = config.items.filter((el) => !this.state.chainingConfig.oidList.includes(el));

+                     let config = JSON.parse(content);

+                     let availableOids = config.items.filter((el) => !this.state.chainingConfig.oidList.includes(el));

                      this.setState((prevState) => (

                          {

                              chainingConfig: {
@@ -304,15 +304,19 @@ 

                      const config = JSON.parse(content);

                      let availableComps = config.attrs.nspossiblechainingcomponents;

                      let compList = [];

+                     let oidList = [];

                      if ('nsactivechainingcomponents' in config.attrs) {

                          availableComps = config.attrs.nspossiblechainingcomponents.filter((el) => !config.attrs.nsactivechainingcomponents.includes(el));

                          compList = config.attrs.nsactivechainingcomponents;

                      }

+                     if ('nstransmittedcontrols' in config.attrs) {

+                         oidList = config.attrs.nstransmittedcontrols;

+                     }

                      this.setState(() => (

                          {

                              chainingConfig: {

                                  ...this.state.chainingConfig,

-                                 oidList: config.attrs.nstransmittedcontrols,

+                                 oidList: oidList,

                                  compList: compList,

                                  availableComps: availableComps

                              }

@@ -969,7 +969,13 @@ 

              <div>

                  <Row>

                      <Col sm={10} className="ds-word-wrap">

-                         <ControlLabel className="ds-suffix-header"><Icon type="fa" name="link" /> <b>{this.props.suffix}</b> (<i>{this.props.bename}</i>)</ControlLabel>

+                         <ControlLabel className="ds-suffix-header">

+                             <Icon type="fa" name="link" /> <b>{this.props.suffix}</b> (<i>{this.props.bename}</i>)

+                             <Icon className="ds-left-margin ds-refresh"

+                                 type="fa" name="refresh" title="Refresh database link"

+                                 onClick={() => this.props.reload(this.props.suffix)}

+                             />

+                         </ControlLabel>

                      </Col>

                      <Col sm={2}>

                          <Button

@@ -760,7 +760,13 @@ 

              <div id="suffix-page">

                  <Row>

                      <Col sm={10} className="ds-word-wrap">

-                         <ControlLabel className="ds-suffix-header"><Icon type="fa" name={suffixIcon} /> <b>{this.props.suffix}</b> (<i>{this.props.bename}</i>)</ControlLabel>

+                         <ControlLabel className="ds-suffix-header">

+                             <Icon type="fa" name={suffixIcon} /> {this.props.suffix} (<i>{this.props.bename}</i>)

+                             <Icon className="ds-left-margin ds-refresh"

+                                 type="fa" name="refresh" title="Refresh suffix"

+                                 onClick={() => this.props.reload(this.props.suffix)}

+                             />

+                         </ControlLabel>

                      </Col>

                      <Col sm={2}>

                          <div>

@@ -148,7 +148,7 @@ 

                                      </Row>

                                      <Row className="ds-margin-top">

                                          <Col componentClass={ControlLabel} sm={4}>

-                                             Current Conections

+                                             Current Connections

                                          </Col>

                                          <Col sm={8}>

                                              <input type="text" className="ds-input-auto" id="monitor-server-currentconnections" value={this.props.data.currentconnections} readOnly />

@@ -1279,11 +1279,10 @@ 

                                  Choose the replication role for this suffix.  If it

                                  is a Master replica then you must pick a unique ID

                                  to identify it among the other Master replicas in your

-                                 environment.  You can optionally define the authentication

-                                 information for this replicated suffix, either a Bind DN and

-                                 Password, or a Group DN.  The replication changelog will

-                                 also automatically be created if it does not exist.

+                                 environment.  The replication changelog will also

+                                 automatically be created if it does not exist.

                              </p>

+ 

                              <hr />

                              <Row className="ds-margin-top-lg">

                                  <Col sm={3} componentClass={ControlLabel}>
@@ -1298,8 +1297,18 @@ 

                                  </Col>

                              </Row>

                              {replicaIDRow}

+                             <p className="ds-margin-top-xxlg">

+                                 You can optionally define the authentication information

+                                 for this replicated suffix.  Either a Manager DN and Password,

+                                 a Bind Group DN, or both, can be provideed.  The Manager DN should

+                                 be an entry under "cn=config" and if it does not exist it will

+                                 be created, while the Bind Group DN is usually an existing

+                                 group located in the database suffix.  Typically, just the

+                                 Manager DN and Password are used when enabling replication

+                                 for a suffix.

+                             </p>

                              <hr />

-                             <Row className="ds-margin-top" title="The DN of the replication manager.  If you supply a password the entry will be created in the server (it will also overwrite the entry is it already exists).">

+                             <Row className="ds-margin-top-lg" title="The DN of the replication manager.  If you supply a password the entry will be created in the server (it will also overwrite the entry is it already exists).">

                                  <Col componentClass={ControlLabel} sm={4}>

                                      Replication Manager DN

                                  </Col>
@@ -1339,6 +1348,7 @@ 

                                      />

                                  </Col>

                              </Row>

+                             <hr />

                              <Row className="ds-margin-top" title="The DN of a group that contains users that can perform replication updates">

                                  <Col componentClass={ControlLabel} sm={4}>

                                      Bind Group DN
@@ -1366,6 +1376,7 @@ 

                          <Button

                              bsStyle="primary"

                              onClick={saveHandler}

+                             disabled={this.props.disabled}

                          >

                              Enable Replication

                          </Button>
@@ -1463,6 +1474,7 @@ 

      handleChange: PropTypes.func,

      saveHandler: PropTypes.func,

      spinning: PropTypes.bool,

+     disabled: PropTypes.bool,

      error: PropTypes.object,

  };

  
@@ -1472,6 +1484,7 @@ 

      handleChange: noop,

      saveHandler: noop,

      spinning: false,

+     disabled: false,

      error: {},

  };

  

@@ -42,6 +42,7 @@ 

              enableBindPW: "",

              enableBindPWConfirm: "",

              enableBindGroupDN: "",

+             disabled: false, // Disable repl enable button

              // Disable replication

              showDisableReplModal: false,

              disableChecked: false,
@@ -104,11 +105,12 @@ 

          let attr = e.target.id;

          let valueErr = false;

          let errObj = this.state.errObj;

+         let disable = false;

  

-         if (attr == "enableBindDN" && value != "" && !valid_dn(value)) {

+         if (attr == "enableBindDN" && value != "" && (!valid_dn(value) || !value.includes(','))) {

              valueErr = true;

          }

-         if (attr == "enableBindGroupDN" && value != "" && !valid_dn(value)) {

+         if (attr == "enableBindGroupDN" && value != "" && (!valid_dn(value) || !value.includes(','))) {

              valueErr = true;

          }

          if (attr == "enableBindPW") {
@@ -127,10 +129,24 @@ 

                  errObj.enableBindPWConfirm = false;

              }

          }

+ 

+         // Validate form and disable enable button if something is wrong.

+         if (valueErr) {

+             disable = true;

+         } else {

+             if ((attr != "enableBindPW" && attr != "enableBindPWConfirm" && this.state.enableBindPW != this.state.enableBindPWConfirm) ||

+                 (this.state.enableBindDN != "" && attr != "enableBindDN" && (!valid_dn(this.state.enableBindDN) ||

+                                                                              !this.state.enableBindDN.includes(','))) ||

+                 (this.state.enableBindGroupDN != "" && attr != "enableBindGroupDN" && (!valid_dn(this.state.enableBindGroupDN) ||

+                                                                                     !this.state.enableBindGroupDN.includes(',')))) {

+                 disable = true;

+             }

+         }

          errObj[attr] = valueErr;

          this.setState({

              [attr]: value,

-             errObj: errObj

+             errObj: errObj,

+             disabled: disable

          });

      }

  
@@ -395,6 +411,7 @@ 

                      saveHandler={this.enableReplication}

                      spinning={this.state.addManagerSpinning}

                      role={this.state.enableRole}

+                     disabled={this.state.disabled}

                      error={this.state.errObj}

                  />

                  <DoubleConfirmModal

@@ -22,16 +22,19 @@ 

              cipherPref: "default",

              prefs: this.props.cipherPref,

              saving: false,

+             availableCiphers: this.props.supportedCiphers,

          };

  

          this.handlePrefChange = this.handlePrefChange.bind(this);

          this.saveCipherPref = this.saveCipherPref.bind(this);

+         this.handleCipherChange = this.handleCipherChange.bind(this);

      }

  

      componentWillMount () {

          let cipherPref = "default";

          let allowedCiphers = [];

          let deniedCiphers = [];

+         let availableCiphers = this.props.supportedCiphers.slice(0); // Copy array

  

          // Parse SSL cipher attributes (nsSSL3Ciphers)

          if (this.props.cipherPref != "") {
@@ -57,12 +60,31 @@ 

                      deniedCiphers.push(cipher.substring(1));

                  }

              }

+ 

+             // Now modify the available list

+             for (let i = 0; i < availableCiphers.length; i++) {

+                 for (let ii = 0; ii < allowedCiphers.length; ii++) {

+                     if (availableCiphers[i] === allowedCiphers[ii]) {

+                         availableCiphers.splice(i, 1);

+                         i--;

+                         break;

+                     }

+                 }

+                 for (let ii = 0; ii < deniedCiphers.length; ii++) {

+                     if (availableCiphers[i] === deniedCiphers[ii]) {

+                         availableCiphers.splice(i, 1);

+                         i--;

+                         break;

+                     }

+                 }

+             }

          }

  

          this.setState({

              cipherPref: cipherPref,

              allowCiphers: allowedCiphers,

              denyCiphers: deniedCiphers,

+             availableCiphers: availableCiphers,

          });

      }

  
@@ -117,6 +139,30 @@ 

          });

      }

  

+     handleCipherChange (type, values) {

+         let availableCiphers = this.props.supportedCiphers.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]) {

+                     availableCiphers.splice(i, 1);

+                     i--;

+                     break;

+                 }

+             }

+         }

+         if (type == "allow") {

+             this.setState({

+                 allowCiphers: values,

+                 availableCiphers: availableCiphers

+             });

+         } else {

+             this.setState({

+                 denyCiphers: values,

+                 availableCiphers: availableCiphers

+             });

+         }

+     }

+ 

      render () {

          let supportedCiphers = [];

          let enabledCiphers = [];
@@ -200,12 +246,10 @@ 

                              <Typeahead

                                  multiple

                                  onChange={value => {

-                                     this.setState({

-                                         allowCiphers: value

-                                     });

+                                     this.handleCipherChange("allow", value);

                                  }}

                                  selected={this.state.allowCiphers}

-                                 options={this.props.supportedCiphers}

+                                 options={this.state.availableCiphers}

                                  newSelectionPrefix="Add a cipher: "

                                  placeholder="Type a cipher..."

                                  id="allowCipher"
@@ -220,12 +264,10 @@ 

                              <Typeahead

                                  multiple

                                  onChange={value => {

-                                     this.setState({

-                                         denyCiphers: value

-                                     });

+                                     this.handleCipherChange("deny", value);

                                  }}

                                  selected={this.state.denyCiphers}

-                                 options={this.props.supportedCiphers}

+                                 options={this.state.availableCiphers}

                                  newSelectionPrefix="Add a cipher: "

                                  placeholder="Type a cipher..."

                                  id="denyCipher"

@@ -125,6 +125,9 @@ 

  

  export function valid_dn (dn) {

      // Validate value is a valid DN (sanity validation)

+     if (dn.endsWith(',')) {

+         return false;

+     }

      let dn_regex = new RegExp("^([A-Za-z]+=.*)");

      let result = dn_regex.test(dn);

      return result;

@@ -79,27 +79,27 @@ 

                      <div class="ds-inline">

                          <div>

                              <label for="attr-name-view" class="ds-config-label-lrg" title="The attribute name"><b

-                                 >Attribute Name</b></label><input class="ds-input" type="text" id="attr-name-view" size="40" readonly />

+                                 >Attribute Name</b></label><input class="ds-input" type="text" id="attr-name-view" size="40" disabled />

                          </div>

                          <div>

                              <label for="attr-desc-view" class="ds-config-label-lrg" title="The attribute description"><b

-                                 >Description</b></label><input class="ds-input" type="text" id="attr-desc-view" size="40"  readonly />

+                                 >Description</b></label><input class="ds-input" type="text" id="attr-desc-view" size="40"  disabled />

                          </div>

                          <div>

                              <label for="attr-oid-view" class="ds-config-label-lrg" title="The attribute name"><b

-                                 >OID</b></label><input class="ds-input" type="text" id="attr-oid-view" size="40" readonly />

+                                 >OID</b></label><input class="ds-input" type="text" id="attr-oid-view" size="40" disabled />

                          </div>

                          <div>

                              <label for="attr-parent-view" class="ds-config-label-lrg" title="The parent attribute"><b>Parent Attribute</b></label><input

-                                 class="ds-input" type="text" id="attr-parent-view" size="40" readonly />

+                                 class="ds-input" type="text" id="attr-parent-view" size="40" disabled />

                          </div>

                          <div>

                              <label for="attr-syntax-view" class="ds-config-label-lrg" title="The attribute syntax"><b>Attribute Syntax</b></label><input

-                                 class="ds-input" type="text" id="attr-syntax-view" size="40" readonly />

+                                 class="ds-input" type="text" id="attr-syntax-view" size="40" disabled />

                          </div>

                          <div>

                              <label for="attr-usage-view" class="ds-config-label-lrg" title="The parent attribute"><b>Attribute Usage</b></label><input

-                                 class="ds-input" type="text" id="attr-usage-view" size="40" readonly />

+                                 class="ds-input" type="text" id="attr-usage-view" size="40" disabled />

                          </div>

                          <div>

                              <input type="checkbox" class="ds-config-checkbox" id="attr-multivalued-view" disabled="disabled" /><label
@@ -111,22 +111,22 @@ 

                          </div>

                          <div>

                              <label for="attr-alias-view" class="ds-config-label-lrg" title="The attribute alias list separated by space"><b

-                                 >Attribute Aliases</b></label><input class="ds-input" type="text" id="attr-alias-view" size="40" readonly />

+                                 >Attribute Aliases</b></label><input class="ds-input" type="text" id="attr-alias-view" size="40" disabled />

                          </div>

                          <div class="panel panel-default ds-margin-top">

                              <div class="panel-heading"><strong>Matching rules</strong></div>

                                  <div class="panel-body">

                                      <div>

                                          <label for="attr-eq-mr-select-view" class="ds-config-label-lrg"><b>Equality</b></label><input

-                                             class="ds-input" type="text" id="attr-eq-mr-select-view" size="35" readonly />

+                                             class="ds-input" type="text" id="attr-eq-mr-select-view" size="35" disabled />

                                      </div>

                                  <div>

                                      <label for="attr-order-mr-select-view" class="ds-config-label-lrg"><b>Ordering</b></label><input

-                                         class="ds-input" type="text" id="attr-order-mr-select-view" size="35" readonly />

+                                         class="ds-input" type="text" id="attr-order-mr-select-view" size="35" disabled />

                                  </div>

                                  <div>

                                      <label for="attr-sub-mr-select-view" class="ds-config-label-lrg"><b>Substring</b></label><input

-                                         class="ds-input" type="text" id="attr-sub-mr-select-view" size="35" readonly />

+                                         class="ds-input" type="text" id="attr-sub-mr-select-view" size="35" disabled />

                                  </div>

                              </div>

                          </div>
@@ -246,37 +246,37 @@ 

                          <div class="ds-inline">

                              <div>

                                  <label for="oc-name-view" class="ds-config-label-lrg" title="The objectclass name"><b

-                                     >Objectclass Name</b></label><input class="ds-input" type="text" id="oc-name-view" size="40" readonly />

+                                     >Objectclass Name</b></label><input class="ds-input" type="text" id="oc-name-view" size="40" disabled />

                              </div>

                              <div>

                                  <label for="oc-desc-view" class="ds-config-label-lrg" title="The objectClass description"><b

-                                     >Description</b></label><input class="ds-input" type="text" id="oc-desc-view" size="40" readonly/>

+                                     >Description</b></label><input class="ds-input" type="text" id="oc-desc-view" size="40" disabled/>

                              </div>

                              <div>

                                  <label for="oc-oid-view" class="ds-config-label-lrg" title="Objectclass OID (optional)"><b

-                                     >OID (optional)</b></label><input class="ds-input" value="" type="text" id="oc-oid-view" size="40" readonly/>

+                                     >OID (optional)</b></label><input class="ds-input" value="" type="text" id="oc-oid-view" size="40" disabled/>

                              </div>

                              <div>

                                  <label for="oc-parent-view" class="ds-config-label-lrg" title="The parent objectclass"><b>Parent Objectclass</b></label><input

-                                     class="ds-input" value="" type="text" id="oc-parent-view" size="40" readonly />

+                                     class="ds-input" value="" type="text" id="oc-parent-view" size="40" disabled />

                              </div>

                              <div>

                                  <label for="oc-kind-view" class="ds-config-label-lrg" title="The parent objectclass"><b>Objectclass Kind</b></label><input

-                                     class="ds-input" value="" type="text" id="oc-kind-view"  size="40" readonly />

+                                     class="ds-input" value="" type="text" id="oc-kind-view"  size="40" disabled />

                              </div>

                              <hr>

                              <div class="ds-container">

                                  <div>

                                      <label class="ds-config-label" for="oc-required-list-view" title=

                                          "Attributes allowed by the objectclass"><b>Required Attributes</b></label>

-                                     <select id="oc-required-list-view" class="ds-may-must-list" multiple>

+                                     <select id="oc-required-list-view" class="ds-may-must-list" multiple disabled>

                                      </select>

                                  </div>

                                  <div class="ds-divider"></div>

                                  <div>

                                      <label class="ds-config-label" for="oc-allowed-list-view" title=

                                          "Attributes allowed by the objectclass"><b>Allowed Attributes</b></label>

-                                     <select id="oc-allowed-list-view" class="ds-may-must-list" multiple>

+                                     <select id="oc-allowed-list-view" class="ds-may-must-list" multiple disabled>

                                      </select>

                                  </div>

                              </div>

@@ -136,7 +136,7 @@ 

         <form>

           <div>

             <label for="nsslapd-rootdn" class="ds-config-label" title="The DN of the unrestricted directory manager (nsslapd-rootdn).">Directory Manager DN</label><input

-              class="ds-input" type="text" readonly id="nsslapd-rootdn" value="cn=Directory Manager" size="40"/>

+              class="ds-input" type="text" disabled id="nsslapd-rootdn" value="cn=Directory Manager" size="40"/>

           </div>

           <div>

             <label for="nsslapd-rootpw" class="ds-config-label" title="The Directory Manager password (nsslapd-rootpw).">Directory Manager Password</label><input
@@ -951,13 +951,13 @@ 

      <div class="ldapi-attrs ds-inline" hidden>

        <div>

          <label for="nsslapd-ldapifilepath" class="ds-config-label" title="The Unix socket file (nsslapd-ldapifilepath).  The UI requires this exact path so it is a read-only setting.">LDAPI Socket File Path</label><input

-           class="ds-input" type="text" id="nsslapd-ldapifilepath" size="35" readonly/>

+           class="ds-input" type="text" id="nsslapd-ldapifilepath" size="35" disabled/>

        </div>

        <div class="ds-inline">

          <div class="autobind-attrs">

            <div>

              <label for="nsslapd-ldapimaprootdn" class="ds-config-label" title="Map the Unix root entry to this Directory Manager DN (nsslapd-ldapimaprootdn).  The UI requires this to be set to the current root DN so it is a read-only setting">DN to map "root" To</label><input

-               class="ds-input" type="text" id="nsslapd-ldapimaprootdn"  readonly size="35"/>

+               class="ds-input" type="text" id="nsslapd-ldapimaprootdn"  disabled size="35"/>

            </div>

            <div>

              <p></p>

@@ -318,19 +318,21 @@ 

    }

    let cmd = [DSCONF, '-j', 'ldapi://%2fvar%2frun%2f' + server_id + '.socket', 'config', 'replace'];

    cmd.push(mod.attr + "=" + mod.val);

-   cockpit.spawn(cmd, { superuser: true, "err": "message", "environ": [ENV]}).then(function() {

+   cockpit.spawn(cmd, { superuser: true, "err": "message", "environ": [ENV]}).done(function() {

      config_values[mod.attr] = mod.val;

      // Continue with next mods (if any))

      apply_mods(mods);

-   }, function(ex, data) {

-      popup_err("Failed to update attribute: " + mod.attr, data);

-      // Reset HTML for remaining values that have not been processed

-      $("#" + mod.attr).val(config_values[mod.attr]);

-      for (remaining in mods) {

-        $("#" + remaining.attr).val(config_values[remaining.attr]);

-      }

-      check_inst_alive(0);

-      return -1;  // Stop on error

+   })

+   .fail(function(err) {

+     var err_obj = JSON.parse(err);

+     popup_err("Failed to update attribute: " + mod.attr, err_obj.info);

+     // Reset HTML for remaining values that have not been processed

+     $("#" + mod.attr).val(config_values[mod.attr]);

+     for (remaining in mods) {

+       $("#" + remaining.attr).val(config_values[remaining.attr]);

+     }

+     check_inst_alive(0);

+     return -1;  // Stop on error

    });

  }

  
@@ -346,7 +348,8 @@ 

      // Continue with next mods (if any))

      delete_mods(mods);

    }, function(ex, data) {

-      popup_err("Failed to delete attribute: " + mod.attr, data);

+      var err_obj = JSON.parse(data);

+      popup_err("Failed to delete attribute: " + mod.attr, err_obj.info);

       // Reset HTML for remaining values that have not been processed

       $("#" + mod.attr).val(config_values[mod.attr]);

       for (remaining in mods) {

@@ -508,6 +508,16 @@ 

  

      print("Successfully updated database configuration")

  

+ def _format_status(log, mtype, json=False):

+     if json:

+         print(mtype.get_status_json())

+     else:

+         status_dict = mtype.get_status()

+         log.info('dn: ' + mtype._dn)

+         for k, v in list(status_dict.items()):

+            # For each value in the multivalue attr

+             for vi in v:

+                 log.info('{}: {}'.format(k, vi))

  

  def get_monitor(inst, basedn, log, args):

      if args.suffix is not None:
@@ -515,13 +525,13 @@ 

          be = _get_backend(inst, args.suffix)

          monitor = be.get_monitor()

          if monitor is not None:

-             monitor.get_status(use_json=args.json)

+             _format_status(log, monitor, args.json)

              return

          raise ValueError("There was no monitor found for suffix '{}'".format(args.suffix))

      else:

          # Get the global database monitor entry

-         db_mon = MonitorLDBM(inst)

-         db_mon.get_status(use_json=args.json)

+         monitor = MonitorLDBM(inst)

+         _format_status(log, monitor, args.json)

  

  

  def backend_add_index(inst, basedn, log, args):

https://bugzilla.redhat.com/show_bug.cgi?id=1751004
Bug 1751004 - Log Settings "Create New Log Every" takes non integer as input, it even takes alphabets

https://bugzilla.redhat.com/show_bug.cgi?id=1748349
Bug 1748349 - 'View objectclass' modal dialog doesn't have all controls disabled

https://bugzilla.redhat.com/show_bug.cgi?id=1688614
Bug 1688614 - Chaining Configuration Error: Cockpit had an unexpected internal error

https://bugzilla.redhat.com/show_bug.cgi?id=1748355
Bug 1748355 - LDAPI and Autobind configuration should have a warning

https://bugzilla.redhat.com/show_bug.cgi?id=1751157
Bug 1751157 - Cannot Create Database Link

https://bugzilla.redhat.com/show_bug.cgi?id=1751011
Bug 1751011 - DS instance can be easily destroyed by changing non existing Directory Manager DN

https://bugzilla.redhat.com/show_bug.cgi?id=1688663
Bug 1688663 - Cockpit: Enable Replication failed with error "Failed to add replication manager because the base DN of the entry does not exist"

https://bugzilla.redhat.com/show_bug.cgi?id=1751035
Bug 1751035 - Allow and Deny same Ciphers same time

relates: https://pagure.io/389-ds-base/issue/50696

One really minor thing.

I think, instead of this:

for (let ii = 0; ii < deniedCiphers.length; ii++)

it is better to use this format:

for (let cipher in deniedCiphers)

It is less human error-prone and easier to read in general.

The rest looks good! Ack

One really minor thing.
I think, instead of this:
for (let ii = 0; ii < deniedCiphers.length; ii++)

it is better to use this format:
for (let cipher in deniedCiphers)

I can not use that method because of the way I splice the current array and how I manipulate the index counter. I tried it, doesn't work correctly:

        for (let i = 0; i < availableCiphers.length; i++) {
            for (let ci = 0; ci < values.length; ci++) {
                if (availableCiphers[i] === values[ci]) {
                    availableCiphers.splice(i, 1);
                    i--;
                    break;
                }
            }
        }

The issue is where I do the "i--;", this does not work using your proposed method. So what happens is that the next element in availableCiphers gets skipped if we remove/splice the previous element. There is no way to rewind the index counter using "for in array".

Okay, I see... Then yeah, it doesn't make sense to change.

You have my full ack then!

rebased onto 21f2a06

4 years ago

Pull-Request has been merged by mreynolds

4 years ago

389-ds-base is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in 389-ds-base's github repository.

This pull request has been cloned to Github as issue and is available here:
- https://github.com/389ds/389-ds-base/issues/3752

If you want to continue to work on the PR, please navigate to the github issue,
download the patch from the attachments and file a new pull request.

Thank you for understanding. We apologize for all inconvenience.

Pull-Request has been closed by spichugi

3 years ago