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

script query result not converted to correct groovy type

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: OpenIDM 6.0.0, 6.5.0
    • Fix Version/s: 6.5.0
    • Component/s: None
    • Labels:
    • Target Version/s:
    • Verified Version/s:
    • Sprint:
      OpenIDM Sprint 6.5-8
    • Support Ticket IDs:

      Description

      From a groovy script on IDM 6; inconsistency in response when calling “openidm.query(‘managed’user)” and using “_fields” with “authzRoles” versus calling the endpoint without “_fields” 
      Example 1 (All Good):

      Call:

      openidm.query('managed/user', [_queryFilter: 'true’]);

      Response:

      [userName:onajimi, password:[$crypto:[type:x-simple-encryption, value:[cipher:AES/CBC/PKCS5Padding, salt:R+ILm7SgzMjYt5ZxoueJhQ==, data:mws1chL3oT1CrKbGPxa15A==, iv:IZ1R/p8iqqMhrw7T9uIfsw==, key:openidm-sym-default, mac:WDNjfsqjnswMdyF50+hlqQ==]]], _id:008bad3e-25e9-4839-9c12-84379b4f37ca, accountStatus:active, sn:Najimi, mail:onajimi@hubcitymedia.com, givenName:Osana, effectiveAssignments:[], effectiveRoles:[[_ref:managed/role/57cc0c27-097a-483c-a9ae-e9937f534cda]], _rev:6, lastSync:[managedUser_systemOpendjAccount:[effectiveAssignments:[], timestamp:2018-06-12T21:13:51.549]], city:Mute City]

      No issues. Response payload is correctly converted to groovy Maps for all objects.

      =====================================

      Example 2 (Problem):

      Call:

      openidm.query('managed/user', [_queryFilter: 'true', _fields: 'authzRoles']);

      Response:

      [_id:008bad3e-25e9-4839-9c12-84379b4f37ca, _rev:6, authzRoles:[\{ "_ref": "repo/internal/role/openidm-authorized", "_refResourceCollection": "repo/internal/role", "_refResourceId": "openidm-authorized", "_refProperties": \{ "_id": "8ea71ef3-a4b6-4b3f-9600-ef8e600bc261", "_rev": "0" } }, \{ "_ref": "managed/role/57cc0c27-097a-483c-a9ae-e9937f534cda", "_refResourceCollection": "managed/role", "_refResourceId": "57cc0c27-097a-483c-a9ae-e9937f534cda", "_refProperties": \{ "_id": "814ead08-3fb4-4fe6-97e8-be975ea4b556", "_rev": "0" } }]]

      Issue: Top level object is a groovy Map (as expected). Nested objects for “authzRoles” are not converted to groovy Maps. The class type is “jsonValue”.

      Repercussions in IDG: When used in IDG scripts these values will be passed with extra quotes which results in false negatives when comparing values.

      e.g.:

      response.authzRoles[0]._ref == “repo/internal/role/openidm-authorized”

      // FALSE because the left expression has extra quotes.

       

      The comparison is:

      ““repo/internal/role/openidm-authorized”“ == “repo/internal/role/openidm-authorized”

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                dhogan Dirk Hogan
                Reporter:
                mark.offutt Mark Offutt [X] (Inactive)
              • Votes:
                2 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: