Uploaded image for project: 'OpenICF'
  1. OpenICF
  2. OPENICF-1162

LDAP Connector: empty array becomes absent if useTimestampsForSync is used

    Details

      Description

      To reproduce this issue:

      1. Set up a generic DJ connector to either OpenDJ or OpenLDAP, useTimestampsForSync to true. Create an array attribute in the account object.

                      "departmentNumber" : {
                          "type" : "array",
                          "items" : {
                              "type" : "string",
                              "nativeType" : "string"
                              },
                          "nativeType" : "string",
                          "nativeName" : "departmentNumber",
                         "required" : false,
                              "absentIfEmpty" : true
                      }
      

      2. Set up a mapping from ldap to managed/user. Make use of the departmentNumber in one of the script hooks, such as

                          "target" : "deptId",
                          "source" : "departmentNumber",
                          "condition" : {
                              "type" : "text/javascript",
                              "globals" : { },
                              "source" : "logger.error(\"Conditional Update object is: \" + object);\n(object.departmentNumber.length > 0)"
                          },
      

      3. Create an ldap user without any departmentNumber.

      4. Trigger a liveSync. It fails with "Cannot read property "length" from undefined"

      [112] May 13, 2019 2:45:20.328 PM org.forgerock.openidm.script.scope.FunctionFactory$1 call
      SEVERE: Conditional Update object is: { "dn": "uid=test11,dc=example,dc=com", "sn": "test11", "description": "test22", "cn": "test11 test11", "givenName": "tset11", "uid": "test11", "mail": "test11@petample.com", "objectClass": [ "top", "inetOrgPerson", "
      organizationalPerson", "person" ], "_id": "20f80710-127e-4756-aa09-b833ea1ab6f8" }
      [112] May 13, 2019 2:45:20.332 PM org.forgerock.openidm.condition.ScriptedCondition evaluate
      WARNING: Script encountered exception while evaluating condition
      javax.script.ScriptException: TypeError: Cannot read property "length" from undefined
              at org.forgerock.openidm.script.javascript.RhinoScriptEngine$3.newScriptException(RhinoScriptEngine.java:499)
              at org.forgerock.openidm.script.javascript.RhinoScript.eval(RhinoScript.java:261)
      ...
              at org.forgerock.openidm.sync.PropertyMapping.evaluateCondition(PropertyMapping.java:189)
              at org.forgerock.openidm.sync.PropertyMapping.apply(PropertyMapping.java:121)
              at org.forgerock.openidm.sync.SyncOperation.lambda$applyMappings$4(SyncOperation.java:907)
      org.forgerock.openidm.sync.SyncOperation.applyMappings(SyncOperation.java:904)
      

      Reconciliation is not affected. Using changelog for sync is not affected.

        Attachments

          Activity

            People

            • Assignee:
              emanuel.brici Emanuel Brici
              Reporter:
              yinyan.cao Yinyan Cao
              QA Assignee:
              Son Nguyen
            • Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: