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

Not possible anymore to create or update some roles with conditions with MySQL as a repo

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • OpenIDM 5.5.0
    • OpenIDM 5.5.0
    • OpenIDM 5.5-SNAPSHOT(c2e6966e3f905c4d9373fdd7570069a69a6d238a) with MySQL repository

    Description

      After commit c2e696 there is issue with returning empty pagedResultsCookie while updating role with condition causing Status 400 "Unable to decode provided paged results cookie".

      Curl command with error response
      curl --header "If-None-Match: *" --header "Content-Type: application/json" --header "X-OpenIDM-Password: openidm-admin" --header "X-OpenIDM-Username: openidm-admin" --data '{ "name": "role_employee", "description": "Employee Role", "condition": "userName eq 'rsutter'" }' --request PUT "http://localhost:8080/openidm/managed/role/employee"
      
      Response Content:
      {"code":400,"reason":"Bad Request","message":"Unable to decode provided paged results cookie"}
      
      Expected response
      curl --header "If-None-Match: *" --header "Content-Type: application/json" --header "X-OpenIDM-Password: openidm-admin" --header "X-OpenIDM-Username: openidm-admin" --data '{ "name": "role_employee", "description": "Employee Role", "condition": "userName eq 'rsutter'" }' --request PUT "http://localhost:8080/openidm/managed/role/employee"
      
      Response Content:
      {"_id":"employee","_rev":"0","name":"role_employee","description":"Employee Role","condition":"userName eq 'rsutter'"}
      

      I was able to workaround this issue with updating https://stash.forgerock.org/projects/OPENIDM/repos/openidm/commits/c2e6966e3f905c4d9373fdd7570069a69a6d238a#openidm-repo/src/main/java/org/forgerock/openidm/repo/util/PagedResultsCookieUtil.java?T55 (see below) and checking if cookie is empty string. I think cookie should be set to null if it is empty before it is calling function cookieToSortKeyValues().

      This issue can be reproduced only with OpenIDM with MySQL repository.

      Before
      #55    if (cookie == null) {
      
      After
      #55    if (cookie == null || cookie.trim().isEmpty()) {
      

      Attachments

        Activity

          People

            dhogan Dirk Hogan
            michal.orlik@profiq.cz Michal Orlik
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: