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

Custom attributes submitted in request to store in jdbc repo are not stored but the request returns them.

    Details

    • Sprint:
      OpenIDM Sprint 68
    • Story Points:
      3

      Description

      When an entry with custom attributes is created in tables with static schema such as internal/user or repo/link the custom attribute is not stored, however the request returns 200 containing the custom attribute. Then if the entry is queried the custom attributes are missing. This is observed on mysql repository and probably applies to all jdbc repos. For orientdb the custom attributes are actually stored and can be queried back.

      To reproduce:
      1) setup idm with mysql repository
      2) create entry in repo/internal/user

      curl --header "If-None-Match: *" --header "Content-Type: application/json" --header "X-OpenIDM-Password: openidm-admin" --header "X-OpenIDM-Username: openidm-admin" --data '{ "id":"custom-internal-user", "pwd":"custom-internal-user", "roles" : [ "openidm-admin", "openidm-authorized"], "password":"Passw0rd", "custom_attr": "foo" }' --request PUT "http://localhost:8080/openidm/repo/internal/user/custom-internal-user1" | jq .
      
       % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                       Dload  Upload   Total   Spent    Left  Speed
      100   476    0   318  100   158   3668   1822 --:--:-- --:--:-- --:--:--  3697
      {
        "custom_attr": "foo", <-- custom attribute is returned
        "password": {
          "$crypto": {
            "type": "salted-hash",
            "value": {
              "data": "PE1CJQhvGT5Lj9pMeRAH3FgVAGM3jpp/+ib2tlGLXVBAWowwdhUNFiBRtfNC7o1e",
              "algorithm": "SHA-256"
            }
          }
        },
        "roles": [
          "openidm-admin",
          "openidm-authorized"
        ],
        "pwd": "custom-internal-user",
        "id": "custom-internal-user",
        "_rev": "0",
        "_id": "custom-internal-user1"
      }
      

      3) query the entry and notice the attribute is missing in the response.

      curl --header "Content-Type: application/json" --header "X-OpenIDM-Password: openidm-admin" --header "X-OpenIDM-Username: openidm-admin" --request GET "http://localhost:8080/openidm/repo/internal/user/?_queryFilter=_id+eq+'custom-internal-user1'&_fields=custom_attr,roles" | jq .
      
        % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                       Dload  Upload   Total   Spent    Left  Speed
      100   227    0   227    0     0   3512      0 --:--:-- --:--:-- --:--:--  3546
      {
        "remainingPagedResults": -1,
        "totalPagedResults": -1,
        "totalPagedResultsPolicy": "NONE",
        "pagedResultsCookie": null,
        "resultCount": 1,
        "result": [
          {
            "roles": [
              "openidm-admin",
              "openidm-authorized"
            ],
            "_rev": "0",
            "_id": "custom-internal-user1"
          }
        ]
      }
      

      the same applies for repo/link
      CREATE

      curl --header "If-None-Match: *" --header "Content-Type: application/json" --header "X-OpenIDM-Password: openidm-admin" --header "X-OpenIDM-Username: openidm-admin" --data '{"_id":"c1953f6a-773a-4b5e-93ff-c3ae0ad8a170","firstId":"bjensena","linkQualifier":"default","secondId":"bjensena","linkType":"systemXmlfileAccounts_managedUser", "custom_attr" : "foo"}' -X PUT "http://localhost:8080/openidm/repo/link/c1953f6a-773a-4b5e-93ff-c3ae0ad8a170" | jq .
      
        % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                       Dload  Upload   Total   Spent    Left  Speed
      100   378    0   193  100   185   2691   2579 --:--:-- --:--:-- --:--:--  2718
      {
        "custom_attr": "foo", <-- custom attribute
        "linkType": "systemXmlfileAccounts_managedUser",
        "secondId": "bjensena",
        "linkQualifier": "default",
        "firstId": "bjensena",
        "_rev": "0",
        "_id": "c1953f6a-773a-4b5e-93ff-c3ae0ad8a170"
      }
      

      GET

      curl --header "Content-Type: application/json" --header "X-OpenIDM-Password: openidm-admin" --header "X-OpenIDM-Username: openidm-admin" -X GET "http://localhost:8080/openidm/repo/link/?_queryFilter=_id+eq+'c1953f6a-773a-4b5e-93ff-c3ae0ad8a170'&_fields=custom_attr,firstId" | jq .  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                       Dload  Upload   Total   Spent    Left  Speed
      100   216    0   216    0     0   3353      0 --:--:-- --:--:-- --:--:--  3375
      {
        "remainingPagedResults": -1,
        "totalPagedResults": -1,
        "totalPagedResultsPolicy": "NONE",
        "pagedResultsCookie": null,
        "resultCount": 1,
        "result": [
          {
            "firstId": "bjensena",
            "_rev": "0",
            "_id": "c1953f6a-773a-4b5e-93ff-c3ae0ad8a170"
          }
        ]
      }
      

      and for audit/activity
      CREATE

      curl --header "If-None-Match: *" --header "Content-Type: application/json" --header "X-OpenIDM-Password: openidm-admin" --header "X-OpenIDM-Username: openidm-admin" --data '{"_id":"11ae40e2-0724-4067-b30d-13f62d4c9ae1","transactionId":"6a0c2b82-f3d9-43e7-83e9-b40724ef2ffe-2","timestamp":"2015-11-06T13:16:44.237Z","eventName":"activity","authentication":{"id":"openidm-admin"},"runAs":"openidm-admin","resourceOperation":{"uri":"","protocol":"CREST","operation":{"method":"CREATE"}},"before":null,"after":"{ \"mail\": \"bjensen@example.com\", \"givenName\": \"Barbara\", \"sn\": \"Jensen\", \"description\": \"Created By XML1\", \"_id\": \"bjensen\", \"userName\": \"bjensen@example.com\", \"password\": { \"$crypto\": { \"value\": { \"iv\": \"n6Pr8DUUI9hkZORdapMecw==\", \"data\": \"f0Mr0AKhS62V5Sab/MzYpg==\", \"cipher\": \"AES/CBC/PKCS5Padding\", \"key\": \"openidm-sym-default\" }, \"type\": \"x-simple-encryption\" } }, \"telephoneNumber\": \"1234567\", \"accountStatus\": \"active\", \"effectiveRoles\": null, \"effectiveAssignments\": [  ], \"_rev\": \"1\" }","changedFields":[],"revision":"1","message":"create","objectId":"managed/user/bjensen","passwordChanged":true,"status":"SUCCESS", "custom_attr" : "foo"}' -X PUT "http://localhost:8080/openidm/audit/activity/11ae40e2-0724-4067-b30d-13f62d4c9ae1" | jq .
      
        % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                       Dload  Upload   Total   Spent    Left  Speed
      100  2102    0  1055  100  1047   3060   3037 --:--:-- --:--:-- --:--:--  3057
      {
        "custom_attr": "foo",
        "resourceOperation": {
          "operation": {
            "method": "CREATE"
          },
          "protocol": "CREST",
          "uri": ""
        },
        "runAs": "openidm-admin",
        "authentication": {
          "id": "openidm-admin"
        },
        "eventName": "activity",
        "timestamp": "2015-11-06T13:16:44.237Z",
        "transactionId": "6a0c2b82-f3d9-43e7-83e9-b40724ef2ffe-2",
        "_rev": "0",
        "_id": "11ae40e2-0724-4067-b30d-13f62d4c9ae1",
        "before": null,
        "after": "{ \"mail\": \"bjensen@example.com\", \"givenName\": \"Barbara\", \"sn\": \"Jensen\", \"description\": \"Created By XML1\", \"_id\": \"bjensen\", \"userName\": \"bjensen@example.com\", \"password\": { \"$crypto\": { \"value\": { \"iv\": \"n6Pr8DUUI9hkZORdapMecw==\", \"data\": \"f0Mr0AKhS62V5Sab/MzYpg==\", \"cipher\": \"AES/CBC/PKCS5Padding\", \"key\": \"openidm-sym-default\" }, \"type\": \"x-simple-encryption\" } }, \"telephoneNumber\": \"1234567\", \"accountStatus\": \"active\", \"effectiveRoles\": null, \"effectiveAssignments\": [  ], \"_rev\": \"1\" }",
        "changedFields": [],
        "revision": "1",
        "message": "create",
        "objectId": "managed/user/bjensen",
        "passwordChanged": true,
        "status": "SUCCESS"
      }
      

      GET

      curl --header "Content-Type: application/json" --header "X-OpenIDM-Password: openidm-admin" --header "X-OpenIDM-Username: openidm-admin" -X GET "http://localhost:8080/openidm/audit/activity/?_queryFilter=_id+sw+'11ae40e2-0724-4067-b30d-13f62d4c9ae1'&_fields=custom_attr,transactionId" | jq .
        % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                       Dload  Upload   Total   Spent    Left  Speed
      100   241    0   241    0     0   4075      0 --:--:-- --:--:-- --:--:--  4084
      {
        "remainingPagedResults": -1,
        "totalPagedResults": -1,
        "totalPagedResultsPolicy": "NONE",
        "pagedResultsCookie": null,
        "resultCount": 1,
        "result": [
          {
            "transactionId": "6a0c2b82-f3d9-43e7-83e9-b40724ef2ffe-2",
            "_id": "11ae40e2-0724-4067-b30d-13f62d4c9ae1"
          }
        ]
      }
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                travis.haagen Travis Haagen
                Reporter:
                Ladislav.Folta Ladislav Folta
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: