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

Unable to create user with virtual attribute defined when using explicit mappings

    Details

    • Target Version/s:
    • Verified Version/s:
    • Story Points:
      3
    • Sprint:
      OpenIDM Sprint 82, OpenIDM Sprint 6.5-2, OpenIDM Sprint 6.5-3
    • Support Ticket IDs:

      Description

      Using explicit mappings (postgres) for managed user in latest 5.5. Default configuration.

      1. Defined my managed_user table in postgres (adapted from db/mysql/scripts/sample-explicit-managed-user.sql)

      CREATE TABLE IF NOT EXISTS openidm.managed_user (
          objectid VARCHAR(38) NOT NULL,
          rev VARCHAR(38) NOT NULL,
          userName VARCHAR(255),
          password VARCHAR(255),
          accountStatus VARCHAR(255),
          postalCode VARCHAR(255),
          stateProvince VARCHAR(255),
          postalAddress VARCHAR(255),
          address2 VARCHAR(255),
          country VARCHAR(255),
          city VARCHAR(255),
          givenName VARCHAR(255),
          description VARCHAR(255),
          sn VARCHAR(255),
          telephoneNumber VARCHAR(255),
          mail VARCHAR(255),
          kbaInfo TEXT,
          lastSync TEXT,
          preferences TEXT,
          idpData TEXT,
          lastChanged TEXT,
          consentedMappings TEXT,
          termsAccepted TEXT,
          PRIMARY KEY (objectid)
      );
      
      

      2. Modified repo.jdbc.json to use explicit tables as described in db/mysql/conf/repo.jdbc-mysql-explicit-managed-user.json

      3. Defined a virtual attribute:

                          "scopes" : {
                              "description" : "",
                              "title" : "Scopes",
                              "viewable" : true,
                              "searchable" : true,
                              "userEditable" : false,
                              "policies" : [ ],
                              "returnByDefault" : true,
                              "isVirtual" : true,
                              "type" : "array",
                              "items" : {
                                  "type" : "string"
                              },
                              "onRetrieve" : {
                                  "type" : "text/javascript",
                                  "source" : "logger.info(\"***** scopes **\");\nvar test = [\"11\",\"22\"];\ntest;"
                              }
      
      

      4. Created a user via Admin UI (here's the WebTools network capture)

      POST /openidm/managed/user?_action=create 
      --data-binary '{"preferences":{"updates":false,"marketing":false},"mail":"jason@fr.com","sn":"jason","description":"jason","givenName":"jason","userName":"jason","scopes":[]}' --compressed --insecure
      

      5. Get this error response

      {"code":400,"reason":"Bad Request","message":"Unmapped fields [/scopes/0, /scopes/1] for type managed/user and table openidm.managed_user"}
      

      These exact steps work in 4.5. There was no need to map the virtual property fields to the table managed_user. Perhaps that has changed?

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                nabil.maynard Nabil Maynard
                Reporter:
                mark.offutt Mark Offutt [X] (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: