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

Relationship signal propagation not working for patch operations against singleton relationships

    XMLWordPrintable

    Details

    • 2
    • 2020.04 - IDM, 2020.05 - IDM, 2020.06 - IDM, 2020.07 - IDM

      Description

      The notifyRelationships configuration can be applied to any managed object field. Its value is an array of relationship fields which should be signaled when the managed object field in question is changed. Any time a managed object is updated, or a signal received, this configuration is consulted to determine whether the signal should be sent/propagated. The configuration includes a JsonPointer of the field in question, and the List of roles to be signaled.

      Now consider a patch on the manager field:

      PATCH http://localhost:8080/openidm/managed/user/brmiller
      {"operation":"replace","field":"manager", "value" : {"_ref":"managed/user/jnelson"}}  

      oldValue In MOS.propagateVertexStateChange

      { "mail": "brendan.miller@forgerock.com", "sn": "Miller", "givenName": "Brendan", "userName": "brmiller", "accountStatus": "active", "managerManager": {  }, "effectiveAssignments": [ ], "effectiveRoles": [ ], "_rev": "0000000073807ea6", "_id": "brmiller", "manager": { "_ref": "managed/user/bjensen", "_refResourceCollection": "managed/user", "_refResourceId": "bjensen", "_refProperties":
      { "_id": "d4bfa652-77b9-4981-91a0-bd8014bbee11", "_rev": "00000000c15b93db" }}}

      newValue in MOS.propagateStateChange

      { "mail": "brendan.miller@forgerock.com", "sn": "Miller", "givenName": "Brendan", "userName": "brmiller", "accountStatus": "active", "managerManager": {  }, "effectiveAssignments": [ ], "effectiveRoles": [ ], "_rev": "0000000073807ea6", "_id": "brmiller", "manager": { "_ref": "managed/user/jnelson" } } 

      (note that the managerManager field is a new virtual property used to test the relationship-derived virtual property mechanism)

      VertexStatePropagator#propagateVertexStateChange is invoked with each of the path fields from the resulting JsonPatch.diff(oldValue, newValue)

      The results of JsonPatch.diff:

      [ { "op": "replace", "path": "/manager/_ref", "value": "managed/user/jnelson" }, { "op": "remove", "path": "/manager/_refResourceCollection" }, { "op": "remove", "path": "/manager/_refResourceId" }, { "op": "remove", "path": "/manager/_refProperties" } ]

      The propagation config in the manager field for my example is

      "notifyRelationships" : ["reports"]

      But we never notify reports because manager/_ref or manager/_ref* is changed - not the bare relationship field.

      This change should examine all parents of the path elements of the JsonPatch.diff elements, and then remove all duplicates so that relationship fields are not signaled redundantly.

       

        Attachments

          Issue Links

            Activity

              People

              dhogan Dirk Hogan
              dhogan Dirk Hogan
              Chris Drake Chris Drake
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: