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

Able to create duplicate array entries using REST

    XMLWordPrintable

    Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Not a defect
    • 6.5.0.2
    • None
    • 6.5.0.2

      Description

      Steps to reproduce

       

      1. Install 6.5.0.2 (reproduced on 6.5.0.4 as well)
      2. Ran with ./startup.sh -p sample/sync-with-csv. You can use whatever you feel like
      3. Go to Configure > Managed Objects and edit the User
      4. Add a testArray, label “Test Array” and for type, select Array and keep the defaults for advance options except for Searchable so you are able to see values in User List view
      5. Click Manage > User and Add a user.  I created test1 as an example and save
      6. Edit the user and add entries into the array.  I added two values: 1 & 2
      7. I see them in User List view. Test Array shows as 1, 2
      8. Go back and edit user and change the value for 2 in the array to a 1. So we should see 1, 1.  What happens is when you hit save, you are left with only 1 value in the array.  Admin UI keeps the values in the array unique

      Next we use REST to patch the user:

      1). Patch:
      http://localhost:8080/openidm/managed/user/7b6f33fb-b6f3-4a4a-8ed1-0a38f8c3899e

      2) payload:

      [

      {      "operation": "add",      "field": "/testArray/-",      "value": "2"    }

      ]

      3) result:

          "testArray": [

              "1",

              "2"

          ]

      }

      4) rerun the patch and get the following results

       "testArray": [

              "1",

              "2",

              "2"

          ]

      Note that I can add as many values of the same thing.  If I go back to User List, I will see 1, 2, 2 for Test Array.  We should not be allowing duplicates.  It should work the same as in the UI.

        Attachments

          Activity

            People

            brmiller Brendan Miller
            jesse.ontiveros Jesse Ontiveros
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: