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

GET on manager/user/user_id/reports/relation_id and managed/user/user_id/manager/relation_id are giving wrong results on user with a manager

    Details

    • Sprint:
      OpenIDM Sprint 70
    • Story Points:
      2

      Description

      Steps to reproduce:

      1) create a first user (boss)

      curl --header "If-None-Match: *" --header "Content-Type: application/json" --header "X-OpenIDM-Password: openidm-admin" --header "X-OpenIDM-Username: openidm-admin" --data '{"userName": "theBoss", "telephoneNumber": "6669876987", "givenName": "rick", "description": "Just another user", "sn": "sutter", "mail": "rick@example.com", "password": "Th3Password"}' --request PUT "http://localhost:8080/openidm/managed/user/boss"
      {"_id":"boss","_rev":"1","userName":"theBoss","telephoneNumber":"6669876987","givenName":"rick","description":"Just another user","sn":"sutter","mail":"rick@example.com","accountStatus":"active","effectiveRoles":[],"effectiveAssignments":[]}
      

      2) create a second user (developer) who is manager of the first user

      curl --header "If-None-Match: *" --header "Content-Type: application/json" --header "X-OpenIDM-Password: openidm-admin" --header "X-OpenIDM-Username: openidm-admin" --data '{"userName": "theDeveloper", "telephoneNumber": "6669876987", "givenName": "rick", "description": "Just another user", "manager": {"_ref": "managed/user/boss"}, "sn": "sutter", "mail": "rick@example.com", "password": "Th3Password"}' --request PUT "http://localhost:8080/openidm/managed/user/developer"
      {"_id":"developer","_rev":"0","userName":"theDeveloper","telephoneNumber":"6669876987","givenName":"rick","description":"Just another user","sn":"sutter","mail":"rick@example.com","accountStatus":"active","effectiveRoles":[],"effectiveAssignments":[]}
      

      So now we have a manager/reports relationship between the two users that we can check on repo/relationships endpoint:

      curl --header "X-OpenIDM-Password: openidm-admin" --header "X-OpenIDM-Username: openidm-admin"  --request GET "http://localhost:8080/openidm/repo/relationships?_queryFilter=true" | jq .
      {
        "result": [
          {
            "_id": "6021d567-aba4-42c8-9261-b2345871f4fe",
            "_rev": "1",
            "firstId": "managed/user/boss",
            "firstPropertyName": "reports",
            "secondId": "managed/user/developer",
            "secondPropertyName": "manager",
            "properties": null
          },...
      

      Here are two requests that give wrong results:

      a) GET on managed/user/developer/reports/relationships_id should return 404 because developer has no report

      curl --header "X-OpenIDM-Password: openidm-admin" --header "X-OpenIDM-Username: openidm-admin"  --request GET "http://localhost:8080/openidm/managed/user/developer/reports/6021d567-aba4-42c8-9261-b2345871f4fe" | jq .
      {
        "_ref": "managed/user/boss",
        "_refProperties": {
          "_id": "6021d567-aba4-42c8-9261-b2345871f4fe",
          "_rev": "1"
        }
      }
      

      => this is NOT OK

      b) GET on managed/user/developer/manager/relationships_id should return the relationship:

      curl --header "X-OpenIDM-Password: openidm-admin" --header "X-OpenIDM-Username: openidm-admin"  --request GET "http://localhost:8080/openidm/managed/user/developer/manager/6021d567-aba4-42c8-9261-b2345871f4fe" | jq .
      {
        "code": 404,
        "reason": "Not Found",
        "message": "Resource '6021d567-aba4-42c8-9261-b2345871f4fe' not found"
      }
      

      => this is not OK

      Note that if we do similar requests on managed/user/developer then is works as expected:

      c) GET on managed/user/boss/reports/relationships_id should return the relationship:

      curl --header "X-OpenIDM-Password: openidm-admin" --header "X-OpenIDM-Username: openidm-admin"  --request GET "http://localhost:8080/openidm/managed/user/boss/reports/6021d567-aba4-42c8-9261-b2345871f4fe" | jq .
      {
        "_ref": "managed/user/developer",
        "_refProperties": {
          "_id": "6021d567-aba4-42c8-9261-b2345871f4fe",
          "_rev": "1"
        }
      }
      

      => this is OK

      d) GET on managed/user/boss/manager/relationships_id should return 404 because boss has no manager

      curl --header "X-OpenIDM-Password: openidm-admin" --header "X-OpenIDM-Username: openidm-admin"  --request GET "http://localhost:8080/openidm/managed/user/boss/manager/6021d567-aba4-42c8-9261-b2345871f4fe" | jq .
      {
        "code": 404,
        "reason": "Not Found",
        "message": "Resource '6021d567-aba4-42c8-9261-b2345871f4fe' not found"
      }
      

      => this is OK

        Attachments

          Activity

            People

            • Assignee:
              dhogan Dirk Hogan
              Reporter:
              laurent.bristiel Laurent Bristiel
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: