Uploaded image for project: 'Red Hat 3scale API Management'
  1. Red Hat 3scale API Management
  2. THREESCALE-7955

User model extra fields not updating via admin portal form

XMLWordPrintable

    • False
    • False
    • Not Started
    • Not Started
    • Not Started
    • Not Started
    • Not Started
    • Not Started
    • +
    • Workaround Exists
    • Hide

      This form is built by a form builder (app/lib/fields/form_builder.rb), and it should be fixed there.

      Extra fields can be updated via the User update API.

      Example cURL request:

      curl -v  -X PUT "https://hot-rox-admin.3scale.net/admin/api/accounts/2445583858583/users/2445584058075.xml" -d 'access_token=<redacted>&org_name=some+company&custom1=1'
      
      Show
      This form is built by a form builder (app/lib/fields/form_builder.rb), and it should be fixed there. Extra fields can be updated via the User update API. Example cURL request: curl -v -X PUT "https: //hot-rox-admin.3scale.net/admin/api/accounts/2445583858583/users/2445584058075.xml" -d 'access_token=<redacted>&org_name=some+company&custom1=1'
    • Hide
      • Create a custom field for the User model via Field Definitions
      • Try to update the value of this field in the admin portal User edit form
      • Notice that the field's value is not updated
      Show
      Create a custom field for the User model via Field Definitions Try to update the value of this field in the admin portal User edit form Notice that the field's value is not updated

      When updating extra fields defined on the User model in the admin portal the values are not updated. The reason seems to be due to the fact we are sending the fields with an incorrect format.

      Request sent by admin portal form POST

      curl 'https://hot-rox-admin.3scale.net/buyers/accounts/2445583858583/users/2445584058075' \
        -H 'Connection: keep-alive' \
        -H 'Cache-Control: max-age=0' \
        -H 'sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="96", "Microsoft Edge";v="96"' \
        -H 'sec-ch-ua-mobile: ?0' \
        -H 'sec-ch-ua-platform: "Windows"' \
        -H 'Upgrade-Insecure-Requests: 1' \
        -H 'Origin: https://hot-rox-admin.3scale.net' \
        -H 'Content-Type: application/x-www-form-urlencoded' \
        -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.55 Safari/537.36 Edg/96.0.1054.34' \
        -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9' \
        -H 'Sec-Fetch-Site: same-origin' \
        -H 'Sec-Fetch-Mode: navigate' \
        -H 'Sec-Fetch-User: ?1' \
        -H 'Sec-Fetch-Dest: document' \
        -H 'Referer: https://hot-rox-admin.3scale.net/buyers/accounts/2445583858583/users/2445584058075/edit' \
        -H 'Accept-Language: en-GB,en;q=0.9,en-US;q=0.8,es;q=0.7,ca;q=0.6' \
        -H 'Cookie: intercom-id-d2rqzz73=3b5b7ebf-03c0-4d0a-9f13-954d44b1cc59; cms-filter-string=%7B%22types%22%3A%5B%5D%7D; user_session=ImNHVEV6RE1ZVHRfYnRFYUk5UFVfbjh6M19mZ05pOVlUQk5ZWlZqQlcxT1Ui--275c2dbd46b02c7044129070d42dd4de5a21d44c; ajs_user_id=2445581476383; ajs_anonymous_id=c17220db-3c3e-4bbc-9c2f-40f97df9ff1c; ajs_group_id=2445581331813; _system_session=dHpuOFM4blJtazluZTFDZS8yYStucWhyMHloMXJBRHN2ZEJxNGxoYmphV0dtdzhsTXFEWC81UXZsUnkrbGZsTk0xdHVzYVB1cUJkY2VFWSsxRFdsNVJBWHNwOXd4WEVCdkZuUnlGWE5YOGZoYVJwZ0NGR3paaXJUQTBWeDl3TG9zYlh2WjFpdzhYenltbnA2S1NmcFo5TlI3bEJuTlpvci8xb3Z3UVVEZnNhQk01dnd0TjlFeUNOVitvSlc5Wm9HNy9CUFJQaGVPZUhvUEJEOEtzRzBRM2JoVEVsSnYxLysyb2JDcnVqbG13TT0tLWg3b2FydjIrSmZqS1BCcCttK2MxRXc9PQ%3D%3D--10d05e837392dbc12f63448e45053ee504ee9b6c; intercom-session-d2rqzz73=Sm5oaEhFejlBck9kRzk0RldwcEFweUt3SFNOMnA5cm1VK1NYQXRSQjBLMndFWEZUaWFnODZ5TG5hNkJLbFdzNS0tZGNGNUFEYWh6TndhMlhUaVZoY2p6QT09--795f8940736ee6aed4b6fd2a98d7e3ccdf4429f1' \
        --data-raw 'utf8=%E2%9C%93&_method=patch&authenticity_token=F4%2F3HFlqhfiDe9mIBnaXepgX30j4CfhCFNWqLth0Uyw5%2Bd54dI5Jin7dakA4MpEUBlXX5nfroPTqutb0%2FqkyhQ%3D%3D&user%5Busername%5D=testagain%40test.com&user%5Bemail%5D=testagain%40test.com&user%5Bextra_fields%5D%5Borg_name%5D=some+company&user%5Bextra_fields%5D%5Bcustom1%5D=1&user%5Bpassword%5D=&user%5Bpassword_confirmation%5D=' \
        --compressed
      

      Notice the extra fields are sent like so:

      &user%5Bextra_fields%5D%5Borg_name%5D=some+company&user%5Bextra_fields%5D%5Bcustom1%5D=1
      

      Request sent by developer portal form POST

      curl 'https://hot-rox-test.3scale.net/admin/account/personal_details' \
        -H 'Connection: keep-alive' \
        -H 'Cache-Control: max-age=0' \
        -H 'sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="96", "Microsoft Edge";v="96"' \
        -H 'sec-ch-ua-mobile: ?0' \
        -H 'sec-ch-ua-platform: "Windows"' \
        -H 'Upgrade-Insecure-Requests: 1' \
        -H 'Origin: https://hot-rox-test.3scale.net' \
        -H 'Content-Type: application/x-www-form-urlencoded' \
        -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.55 Safari/537.36 Edg/96.0.1054.34' \
        -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9' \
        -H 'Sec-Fetch-Site: same-origin' \
        -H 'Sec-Fetch-Mode: navigate' \
        -H 'Sec-Fetch-User: ?1' \
        -H 'Sec-Fetch-Dest: document' \
        -H 'Referer: https://hot-rox-test.3scale.net/admin/account/personal_details' \
        -H 'Accept-Language: en-GB,en;q=0.9,en-US;q=0.8,es;q=0.7,ca;q=0.6' \
        -H 'Cookie: intercom-id-d2rqzz73=3b5b7ebf-03c0-4d0a-9f13-954d44b1cc59; ajs_user_id=2445581476383; ajs_anonymous_id=c17220db-3c3e-4bbc-9c2f-40f97df9ff1c; ajs_group_id=2445581331813; user_session=InByOGhrNUZUM1hrb184WnFyZnZWZEVmTndXVUE4VVRaRmhEQmVodF9obkEi--1e65aeea853748b7490064145f688263d8561540; auth_token=; intercom-session-d2rqzz73=RGh5ZUZUMVhUZkpPMXNycFVzTThvQkswQ051Q0RPOVlUc1paRUtFUEtNbjFJbW1CZGdLNjhQcDhxTHFsQzRTKy0tbEM2U0dmQm51dG55WUI4U1pTQzc5QT09--d08d042f8860295fd1145bfc4a8774aa696d979c; _system_session=TVhwcngwSzhwYWNVcDBqU01oV3lNZzE2NzlibWxrRys3SlZVU2FzQkVUbzNiY3ErMUJMbEVEbUx5N1ZzRVFUczFPM0tLRWVhL2NMdFpUSko1K2creFJJTURjdnBFeEVWYUhpMndDYW94UlZvOFZrWEhTU2thYzh1c0hYMWxLMlBqYTF2V3RucXFwd2JsR2VXSDhrMHRBPT0tLU0yVVpNRWRqWW5mbFF2Sjl6cnN0MVE9PQ%3D%3D--865a442ef153e85c550ab268ff670e371660a353' \
        --data-raw 'utf8=%E2%9C%93&authenticity_token=07otHhUohydxFIDFRvO5DZ%2FKU2o1smz7T%2FrwWc9wvSCTHfHCJDs7DiTg2YzvL0wsQ3%2BwUxQv%2BKFsEBZZeAv38g%3D%3D&_method=put&origin=&user%5Busername%5D=testagain%40test.com&user%5Bemail%5D=testagain%40test.com&user%5Borg_name%5D=some+other+company&user%5Bcustom1%5D=2&user%5Bpassword%5D=&user%5Bpassword_confirmation%5D=&commit=Update+Personal+Details' \
        --compressed
      

      Notice the extra fields are sent like so:

      user%5Borg_name%5D=some+other+company&user%5Bcustom1%5D=2
      

      We don't send [extra_fields] which results in a successful PATCH of the User object.

            Unassigned Unassigned
            rhn-support-keprice Kevin Price
            Votes:
            3 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated: