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

Virtual properties calculation throws 500 error if "returnByDefault" is false on referenced relationship

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: 7.0.0
    • Fix Version/s: None
    • Labels:
      None
    • Environment:
      7.0.0-SNAPSHOT" (build: 20200611190430, revision: c2458b3)

      Description

      Virtual properties calculation throws 500 error if "returnByDefault" is false on referenced relationship, and source object is updated via PATCH on a different property (e.g. 'description'):

      [288] Jun 14, 2020 12:54:08.679 PM org.forgerock.openidm.servlet.internal.ResourceFilters$3 lambda$handleRequestWithLogging$8
      WARNING: Resource exception: 500 Internal Server Error: "/_refResourceCollection: Expecting a value"
      

      To reproduce, define a virtual property on managed/user, e.g.:

      "effectiveMemberOf" : {
                              "title" : "effectiveMemberOf",
                              "type" : "array",
                              "viewable" : true,
                              "searchable" : false,
                              "userEditable" : true,
                              "items" : {
                                  "type" : "string"
                              },
                              "description" : null,
                              "isVirtual" : true,
                              "returnByDefault" : false,
                              "deleteQueryConfig" : false,
                              "queryConfig" : {
                                  "referencedRelationshipFields" : [
                                      "memberOf"
                                  ],
                                  "referencedObjectFields" : [
                                      "_id"
                                  ]
                              }

      The referenced relationship should look like this:

      "memberOf" : {
                              "description" : null,
                              "title" : "Memberof",
                              "viewable" : true,
                              "searchable" : false,
                              "userEditable" : false,
                              "policies" : [ ],
                              "returnByDefault" : false,
                              "minLength" : null,
                              "pattern" : null,
                              "notifySelf" : true,
                              "type" : "array",
                              "items" : {
                                  "type" : "relationship",
                                  "reverseRelationship" : true,
                                  "reversePropertyName" : "members",
                                  "validate" : false,
                                  "properties" : {
                                      "_ref" : {
                                          "type" : "string"
                                      },
                                      "_refProperties" : {
                                          "type" : "object",
                                          "properties" : {
                                              "_id" : {
                                                  "type" : "string",
                                                  "required" : false,
                                                  "propName" : "_id"
                                              }
                                          }
                                      }
                                  },
                                  "resourceCollection" : [
                                      {
                                          "path" : "managed/account",
                                          "label" : "Customer Account",
                                          "query" : {
                                              "queryFilter" : "true",
                                              "fields" : [
                                                  "name"
                                              ],
                                              "sortKeys" : [ ]
                                          },
                                          "notify" : false
                                      }
                                  ]
                              }
                          }

      Next, trigger a change of the managed user by updating an arbitrary, non-related attribute, e.g. description.
      Result: Internal Server Error.

      Now change 'returnByDefault' to 'true' on the memberOf property and repeat the update.
      Result: Success.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              dhogan Dirk Hogan
              Reporter:
              tim.vogt Tim Vogt
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: