{
  "mappings" : [
    {
      "name" : "managedUser_systemLdapAccounts",
      "source" : "managed/user",
      "target" : "system/ldap/account",
      "enableSync" : true,
      "onCreate" : {
        "type" : "text/javascript",
        "source" : "target.dn = 'uid=' + source.userName + ',ou=people,ou=identities';"
      },
      "properties" : [
        {
          "source" : "givenName",
          "target" : "givenName"
        },
        {
          "source" : "sn",
          "target" : "sn"
        },
        {
          "source" : "",
          "transform" : {
            "type" : "text/javascript",
            "source" : "source.displayName || (source.givenName + ' ' + source.sn);"
          },
          "target" : "cn"
        },
        {
          "source" : "",
          "transform" : {
            "type" : "text/javascript",
            "source" : "[source._id, source.userName]"
          },
          "target" : "uid"
        },
        {
          "target" : "dn",
          "source" : "userName",
          "transform" : {
            "type" : "text/javascript",
            "source" : "\"uid=\" + source + \",ou=people,ou=identities\"" }
        },
        {
          "source" : "description",
          "target" : "description",
          "condition" : {
            "type" : "text/javascript",
            "source" : "!!object.description"
          }
        },
        {
          "source" : "mail",
          "target" : "mail"
        },
        {
          "source" : "password",
          "condition" : {
            "type" : "text/javascript",
            "source" : "object.password != null"
          },
          "transform" : {
            "type" : "text/javascript",
            "source" : "openidm.decrypt(source);"
          },
          "target" : "userPassword"
        },
        {
          "source" : "telephoneNumber",
          "target" : "telephoneNumber",
          "condition" : {
            "type" : "text/javascript",
            "source" : "!!object.telephoneNumber"
          }
        },
        {
          "source" : "aliasList",
          "target" : "aliasList"
        },
        {
          "target" : "objectClass",
          "default" : [
            "top",
            "inetuser",
            "person",
            "inetOrgPerson",
            "organizationalPerson",
            "iplanet-am-user-service",
            "kbaInfoContainer"
          ]
        },
        {
          "target" : "kbaInfo",
          "source" : "kbaInfo",
          "transform" : {
            "type" : "groovy",
            "globals" : { },
            "source" : "source ? (source.collect {(new groovy.json.JsonBuilder(it)).toString()}) : []"
          }
        }
      ],
      "policies" : [
        {
          "situation" : "CONFIRMED",
          "action" : "UPDATE"
        },
        {
          "situation" : "FOUND",
          "action" : "LINK"
        },
        {
          "situation" : "ABSENT",
          "action" : "CREATE"
        },
        {
          "situation" : "AMBIGUOUS",
          "action" : "IGNORE"
        },
        {
          "situation" : "MISSING",
          "action" : "IGNORE"
        },
        {
          "situation" : "SOURCE_MISSING",
          "action" : "DELETE"
        },
        {
          "situation" : "UNQUALIFIED",
          "action" : "IGNORE"
        },
        {
          "situation" : "UNASSIGNED",
          "action" : "DELETE"
        }
      ]
    }
  ]
}