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

Delete request with HTTP "If-Match *" header does not work on repo endpoints

    Details

    • Story Points:
      5

      Description

      Delete with "if match *" not working on repo endpoint

      1) first example with repo/link

      a) we have 2 links

      curl --header "X-OpenIDM-Username: openidm-admin" --header "X-OpenIDM-Password: openidm-admin" --request GET "http://localhost:8080/openidm/repo/link/?_queryId=query-all-ids"  | jq '.'
      {
        "result": [
          {
            "_id": "8e353921-b959-4000-ac2e-5b984394c3ce",
            "_rev": "1"
          },
          {
            "_id": "fa060ef9-6024-4f3b-9777-9ddb20098615",
            "_rev": "1"
          }
        ],
      }
      

      b) we try to delete a link with if match * => refused

      curl --header "X-OpenIDM-Username: openidm-admin" --header "X-OpenIDM-Password: openidm-admin" --header "If-Match: *" --request DELETE http://localhost:8080/openidm/repo/link/8e353921-b959-4000-ac2e-5b984394c3ce | jq .
      {
        "code": 409,
        "reason": "Conflict",
        "message": "Object passed into delete does not have revision it expects set."
      }
      

      c) we can delete it if we provide the good revision

      curl --header "X-OpenIDM-Username: openidm-admin" --header "X-OpenIDM-Password: openidm-admin" --header "If-Match: 1" --request DELETE http://localhost:8080/openidm/repo/link/8e353921-b959-4000-ac2e-5b984394c3ce | jq .
      {
        "_id": "8e353921-b959-4000-ac2e-5b984394c3ce",
        "_rev": "1",
        "linkQualifier": "default",
        "secondId": "bjensen",
        "linkType": "systemXmlfileAccounts_managedUser",
        "firstId": "bjensen"
      }
      

      2) example with assignments
      a) we try to delete an assignment with if match * => refused

      curl --header "X-OpenIDM-Password: openidm-admin" --header "X-OpenIDM-Username: openidm-admin" --header "If-Match: *" --request DELETE "http://localhost:8080/openidm/repo/relationships/81887436-dc7c-4b3b-b195-369c9fd9e99e"
      {"code":409,"reason":"Conflict","message":"Object passed into delete does not have revision it expects set."}
      

      c) we can delete it if we provide the good revision

      curl --header "X-OpenIDM-Password: openidm-admin" --header "X-OpenIDM-Username: openidm-admin" --header "If-Match: 16" --request DELETE "http://localhost:8080/openidm/repo/relationships/c14f089e-079e-43b9-ac0d-02f7ba44c90c"
      {"_id":"c14f089e-079e-43b9-ac0d-02f7ba44c90c","_rev":"16","firstId":"managed/user/ricksutter","firstPropertyName":"/authzRoles","secondId":"repo/internal/role/openidm-authorized","properties":null}
      

      We have the same problem with internal users (openidm/repo/internal/user) and probably with any other repo endpoint.

        Attachments

          Activity

            People

            • Assignee:
              brmiller Brendan Miller
              Reporter:
              laurent.bristiel Laurent Bristiel
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: