Uploaded image for project: 'OpenIDM'
  1. OpenIDM
  2. OPENIDM-7199

Policies not executed for multiple type attributes

    Details

      Description

      As an example, changing the type of managed/user password to [ "string","null" ] will prevent the policies from being checked. There is some code in bin/defaults/script/policy.js that handles the case that the type of an attribute is an array of choices, but at runtime this script is not seeing the array [ "string", "null" ] but rather the object

      {"0":"string","1":"null"}

      .
      As a first idea for a fix some code could be added to convert the object back to an array, like

      var pType = pair[1].type;

      if (pType instanceof Object) {
      pType = Object.keys(pType).map(function (key)

      { return pType[key]; }

      );
      }

      if ((.isArray(pType) && !.contains(pair[1].type, "null")) ||
      (_.isNumber(pair[1].minLength) && pair[1].minLength > 0)) {
      standardPolicies.push(

      { "policyId" : "not-empty" }

      );
      }

      if ((_.isArray(pType) && _.contains(pType, "string")) ||
      (pType === "string")) {
      ...

        Attachments

          Activity

            People

            • Assignee:
              jake.feasel Jake Feasel
              Reporter:
              matthias.grabiak Matthias Grabiak
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: