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

openidm.patch returns null when a no effect patch is called

    Details

      Description

      Using openidm.patch, when

      1) a change is made to the object - openidm.patch returns the full object, but when

      2) no change is made to the object - openidm.patch returns null.

      The view is that for (2) the full object should be returned.

      Example of issue. Using the following from a custom endpoint

              var map = [
                         {
                             "operation": "replace",
                             "field": "mail",
                             "value": request.additionalParameters.mail
                         },
                         {
                             "operation": "replace",
                             "field": "postCode",
                             "value": request.additionalParameters.postalCode
                         }
                         ];
              return {
                         result: openidm.patch("managed/user/" + request.additionalParameters.user, null, map)
      

      When using following managed/user object

      [openidm@localhost ~]$ curl  -v  --header "X-OpenIDM-Username: openidm-admin"  --header "X-OpenIDM-Password: openidm-admin"  --request GET  "http://localhost:48080/openidm/managed/user/bjensen" | python -m json.tool
      * About to connect() to localhost port 48080 (#0)
      *   Trying 127.0.0.1... connected
      * Connected to localhost (127.0.0.1) port 48080 (#0)
      > GET /openidm/managed/user/bjensen HTTP/1.1
      > User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.19.1 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2
      > Host: localhost:48080
      > Accept: */*
      > X-OpenIDM-Username: openidm-admin
      > X-OpenIDM-Password: openidm-admin
      > 
        % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                       Dload  Upload   Total   Spent    Left  Speed
        0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0< HTTP/1.1 200 OK
      < Date: Wed, 04 Nov 2015 13:15:45 GMT
      < Cache-Control: no-cache
      < Content-Type: application/json; charset=UTF-8
      < Set-Cookie: session-jwt=eyAidHlwIjogIkpXVCIsICJhbGciOiAiUlNBRVNfUEtDUzFfVjFfNSIsICJlbmMiOiAiQTEyOENCQ19IUzI1NiIgfQ.gObaC9XvkpSNtUEEPxaU_hxPmD3iF3uhG6DwzX7saHANIZK9_4_j-XxLt32uLzkNt5YRuAF3uKQmoQVTVHj3V-wh0sAxiJrNfKekKUtPE2DtOu5utmr1rKeP2LRKrkxN8JkvwDNbluEXsUvaqubILd7gIIgPeahgfnMg8M1mnLNPBd9eVH-VldZk1tX2tg-CShT5_kmwRms1JtWz6L-1alVtFOtKjaECACSQZhchJPlHzMPSvJ2b73tJ6WC7uA5prBEApoCfuj--ICknFIP3SAhQlQmJhVhIFsES_z0d6y8EaJfWQLQWK526DveK1FHYg7zt16ieTj04SdkaKlTPfg.4W_4aItkQNjBr-t62DWoQw.Vlvymzk_KcPwba7gQ_l33MPBq3FQrobPUK39LqA4JU_3qt0Ixh_v0F7I9pHJ_3LQfPKldEGd6qj-o1e_cygdotpJZVeN2kzBguMtPmcM-rbDzh_XWryLKT4zs2Z_ZOWrV9pgo9p2EIxuApFzQI574T_bZUy9p58SmXCwwP41mM5u6emvTG_50zCg8h_zFLxJBrQ6lULRPp7Yvo1j6_gieJoz-7RifpXPvSCVSzQWhydNPgoaareINUU75MgAGTYBTe4Q6OvMV9Q9YApDq7xQfXHtSU_rqQU_K387tBVFHxoHsAidbuKLPtcYpZn5oKu6wd8fumh96rto8WutkaVNu3Q1nX0qYUyUnAytbSra0laPhnBXl0fxTW5rCxOI0Laol-0KAH64UwUyNsk32yZpw4EbqjOVi7JS3FYDy156NyZ8WvbbzTOw5o0PuhNNVvALDP1yJjRhunKoas4PbD6psp6cAN3I5l8wwf_YQoDH_1KMRfB2AwdKgZv9j-6hJ6tlUNdn-PmTSTSrNfytYCi4sw.4pT00nuchUKGF2uVHqjbiQ; Path=/
      < Vary: Accept-Encoding, User-Agent
      < ETag: "25"
      < Connection: close
      < Server: Jetty(9.2.z-SNAPSHOT)
      < 
      { [data not shown]
      109   549    0   549    0     0   5250      0 --:--:-- --:--:-- --:--:--  5602* Closing connection #0
      
      {
          "_id": "bjensen", 
          "_rev": "25", 
          "accountStatus": "active", 
          "address2": "", 
          "city": "", 
          "country": "", 
          "description": "Created By XML1", 
          "effectiveAssignments": [], 
          "effectiveRoles": [
              "openidm-authorized"
          ], 
          "givenName": "Barbara", 
          "lastPasswordAttempt": "Mon Oct 26 2015 06:00:30 GMT-0400 (EDT)", 
          "lastPasswordSet": "", 
          "mail": "abc@zxycd.com", 
          "password": "Passw0rd", 
          "passwordAttempts": "0", 
          "postCode": "abc1234", 
          "postalAddress": "", 
          "postalCode": "abcd", 
          "roles": [
              "openidm-authorized"
          ], 
          "sn": "Jensen", 
          "stateProvince": "", 
          "telephoneNumber": "1234567", 
          "userName": "bjensen@example.com"
      }
      [openidm@localhost ~]$ 
      

      then for (1) above (where patch yields a change to the object),

      [openidm@localhost ~]$ curl  -v  --header "X-OpenIDM-Username: openidm-admin"  --header "X-OpenIDM-Password: openidm-admin"  --request GET  "http://localhost:48080/openidm/endpoint/echo?user=bjensen&mail=abc@zxycd.com&postalCode=abc12345" | python -m json.tool
      * About to connect() to localhost port 48080 (#0)
      *   Trying 127.0.0.1... connected
      * Connected to localhost (127.0.0.1) port 48080 (#0)
      > GET /openidm/endpoint/echo?user=bjensen&mail=abc@zxycd.com&postalCode=abc12345 HTTP/1.1
      > User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.19.1 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2
      > Host: localhost:48080
      > Accept: */*
      > X-OpenIDM-Username: openidm-admin
      > X-OpenIDM-Password: openidm-admin
      > 
        % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                       Dload  Upload   Total   Spent    Left  Speed
        0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0< HTTP/1.1 200 OK
      < Date: Wed, 04 Nov 2015 13:18:55 GMT
      < Cache-Control: no-cache
      < Content-Type: application/json; charset=UTF-8
      < Set-Cookie: session-jwt=eyAidHlwIjogIkpXVCIsICJhbGciOiAiUlNBRVNfUEtDUzFfVjFfNSIsICJlbmMiOiAiQTEyOENCQ19IUzI1NiIgfQ.F2xPNbLEvDJJA1WnKti3awz8vtFceiiPjHaWvYAygG6Ia5SBic_LBDMohc7bW54EO5ide6hJOY-8zvZ6n0ZbdLsrACTGjeYbl_6GVK4zBA62h8f3a1ZaNfuM48SvwV8uTZpLTuEwFPJOw1DcwaCzIgRbjYStAZQ2Uox0c7PAsBVoXN8Dshys8dY5T3XJyx_JwkDXeYYk8jcq4iGo7CyChLZZrYnUUZMN49-TCvEQV6leoWyfGI--wQ0hiWcmnz2vgjlUWi0juX5kEPeqRF7mTRaZNlNkeS4QrQ80hZMa0OPMdvcc1bsQpJ-QvIpL74ltTetpP9iV1WJcq2jYagb7JA.K2q6u6Zm3thEEWX15bVy3A.w9-80hmsYV9IgS__jd6Y5pzM4JJ_ovzcTGtJWAcL9xO2DiIZ_tgAANnMLNOborWmE7eAILyMYZcSe24RqZD7ib_GL_DAEdknjD8u5ASy-TgP-vmVQdXXs0MYVP75MDUl7QOjCMo5KaatzRV3kwBXyKMYGhcQ3EPBEU0xt-XzWth6KNn0va7QtK14biY9trs_rgFNjqfjkAlIqdQcDOK-TWkWjVYjsEQkAmFCtT4HBQuQBbQinfK1Oqy36LNtYsn8IXDVG8WGhBl92QAgfZwXpMsiVPLIQPTcGTKCSDeXQqzAS0rvf-e8PydbmwvQajH576FfizzZT7u-cad3I0Du6MAdnhRS1NMuzR3C_EYdooUFab2CI9C8iIAsk02VPV6yxgMkaQSufHF0MFNggsHRcAg2F2CdlZ1N5Eebn7WjD813DzD0MP48RhLxvDF4Nn9zkiHiW3kkhS2V6nkX5Q9Og0MQUhmXgaRrJ2BsaPOGNmNJyaO25taDQjYwp1w4MQzkb7weB7o6EHpVEF3H0rmryg.6MzxthSNKx3EL_IpK1Ukvw; Path=/
      < Vary: Accept-Encoding, User-Agent
      < Connection: close
      < Server: Jetty(9.2.z-SNAPSHOT)
      < 
      { [data not shown]
      114   570    0   570    0     0   1472      0 --:--:-- --:--:-- --:--:--  1532* Closing connection #0
      
      {
          "_id": "", 
          "result": {
              "_id": "bjensen", 
              "_rev": "26", 
              "accountStatus": "active", 
              "address2": "", 
              "city": "", 
              "country": "", 
              "description": "Created By XML1", 
              "effectiveAssignments": [], 
              "effectiveRoles": [
                  "openidm-authorized"
              ], 
              "givenName": "Barbara", 
              "lastPasswordAttempt": "Mon Oct 26 2015 06:00:30 GMT-0400 (EDT)", 
              "lastPasswordSet": "", 
              "mail": "abc@zxycd.com", 
              "password": "Passw0rd", 
              "passwordAttempts": "0", 
              "postCode": "abc12345", 
              "postalAddress": "", 
              "postalCode": "abcd", 
              "roles": [
                  "openidm-authorized"
              ], 
              "sn": "Jensen", 
              "stateProvince": "", 
              "telephoneNumber": "1234567", 
              "userName": "bjensen@example.com"
          }
      }
      [openidm@localhost ~]$ 
      

      And for (2), where no effect results from the patch

      [openidm@localhost ~]$ curl  -v  --header "X-OpenIDM-Username: openidm-admin"  --header "X-OpenIDM-Password: openidm-admin"  --request GET  "http://localhost:48080/openidm/endpoint/echo?user=bjensen&mail=abc@zxycd.com&postalCode=abc12345" | python -m json.tool
      * About to connect() to localhost port 48080 (#0)
      *   Trying 127.0.0.1... connected
      * Connected to localhost (127.0.0.1) port 48080 (#0)
      > GET /openidm/endpoint/echo?user=bjensen&mail=abc@zxycd.com&postalCode=abc12345 HTTP/1.1
      > User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.19.1 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2
      > Host: localhost:48080
      > Accept: */*
      > X-OpenIDM-Username: openidm-admin
      > X-OpenIDM-Password: openidm-admin
      > 
        % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                       Dload  Upload   Total   Spent    Left  Speed
        0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0< HTTP/1.1 200 OK
      < Date: Wed, 04 Nov 2015 13:19:59 GMT
      < Cache-Control: no-cache
      < Content-Type: application/json; charset=UTF-8
      < Set-Cookie: session-jwt=eyAidHlwIjogIkpXVCIsICJhbGciOiAiUlNBRVNfUEtDUzFfVjFfNSIsICJlbmMiOiAiQTEyOENCQ19IUzI1NiIgfQ.Zl7gEe5pz3IAnRcK2Bw0O-vvJEE6eP-l5JiQXwvasQXEf7gk_8i3vWs4o7gZid-CbvW0mttWOTqY4JJxIvA3Tw9uMIAhM5AvjIGG4q1NS1kXTG3luW0ySKABNa1ZcC4Xq6iMwOYDseTECTEVN5dpwG0RBcovlL9tjPn4Mj2T6ar47UHQgBr26VPSH0yan6U3HP57tM3G-ik4TT8G24U0fyhyMDo2hBrlQKMiC4MM69LOhD_D3Y3JeE9z0vJoIDlPi-aN0_UO3O-W3JpqvwNRMj2KBHEjsRC8WCxx5m4dKPjAzg7Pn8Iiq0r7J2ZUzYAzQ7wrCYNCNghbEsv8O-J3RA.HvvX543sQpfrkUVMwEpM-w.x3wM7WnrjXpMTxW-Usiw8b-jrX-ZQ7MvxQzeAUgeDxsXMUxE6u4ClJ-pogF1nAleLNazPtRQRcBxJdjkmojw9ZsVE7GucB9kcl2mye9uwZnLcvzvWrAQpJr4iCdnNhj-tg5xrA6hl_GzxkuZwGSygd8wNXJ9CRtmlQVJaMAGlZai613b3jloRlSZvBU7pm8nDhTtCX6G9fl_yB_b4jWM_eGygc9FA-DPdKlfdnyDKapRleSUIYyxu6Ujz4GVoUf9_DwI7mWlGs4KPf8qMbl3A5tsyKs92RHx1OH_UecrUy5v04HK0QarTdwhMeMS865WS8fVytLgXTc8d6DOAd3LqjxyyZpNgzn5YEbV6lFN0X1Yi6Iujl56d4NavQa1d-4t6O_yPzLvwPM9zcL0yM4Pt4ku8b-6rgkQh4IAxhmDBNbYF5Yi2JDHd_T89BscjrQnPYkj3p2MC7wlQIH4_IZbdH_yyXfSZeMdcQ5TlpToj1dAI6N7l_6YrVIM7zcQ3kXg7XQDKEZWHCkU3BDaV6Ma9g.rYAEJldUO25BHCw2G5bELQ; Path=/
      < Vary: Accept-Encoding, User-Agent
      < Connection: close
      < Server: Jetty(9.2.z-SNAPSHOT)
      < 
      { [data not shown]
        0    24    0    24    0     0     84      0 --:--:-- --:--:-- --:--:--    87* Closing connection #0
      
      {
          "_id": "", 
          "result": null
      }
      [openidm@localhost ~]$ 
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                cgdrake Chris Drake
                Reporter:
                johan johan
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: