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

Create manager/reports relationship with POST or PUT work on managed/user/id/reports but fails on managed/user/id/manager

    Details

      Description

      Here is what we would like to do:

      • create 2 independent users
      • create a manager/reports relationship between the 2 with different requests:
        1) POST on managed/user/boss/reports with payload {"_ref":"managed/user/developer","_refProperties":{}} => this works
        2) PUT on managed/user/boss/reports with payload {"_ref":"managed/user/developer","_refProperties":{}} => this works
        3) POST on managed/user/developer/manager with payload {"_ref":"managed/user/boss","_refProperties":{}} => this fails
        4) PUT on managed/user/developer/manager with payload {"_ref":"managed/user/boss","_refProperties":{}} => this fails

      Steps to reproduce the case with POST on managed/user/developer/manager

      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)

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

      3) create relationship between two users with POST

      curl --header "Content-Type: application/json" --header "X-OpenIDM-Password: openidm-admin" --header "X-OpenIDM-Username: openidm-admin" --data '{"_ref":"managed/user/boss","_refProperties":{}}' --request POST "http://localhost:8080/openidm/managed/user/developer/manager?_action=create"
      {"code":400,"reason":"Bad Request","message":"The singleton resource  cannot be created"}
      

      => this is not OK

      Steps to reproduce the case with PUT on managed/user/developer/manager

      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)

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

      3) create relationship between two users with PUT

      curl --header "If-None-Match: *" --header "Content-Type: application/json" --header "X-OpenIDM-Password: openidm-admin" --header "X-OpenIDM-Username: openidm-admin" --data '{"_ref":"managed/user/boss","_refProperties":{}}' --request PUT "http://localhost:8080/openidm/managed/user/developer/manager/id_of_relationship"
      {"code":400,"reason":"Bad Request","message":"The singleton resource  cannot be created"}

      => this is not OK

      According to Dirk: "the manager is a singleton, so it is represented by a SingletonResourceProvider, and that does not support creation, so the request is rejected by CREST"

        Attachments

          Issue Links

            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: