Skip to content
This repository was archived by the owner on Jul 30, 2019. It is now read-only.

Create new internal attribute

Giacomo edited this page Feb 26, 2015 · 11 revisions
  1. Disable the persisted configuration store vi conf/config.properties (optional)
    openidm.config.repo.enabled=false
  2. Go to directory openidm-project/openidm-zip/target/openidm
  3. Edit conf/repo.orientdb.json
  4. Add new attribute matricola. Starting from OpenIDM 3.1.0, is not more necessary to edit all the queries: it is sufficient to edit only the first one, adding the new parameter. This modification is necessary in order to show the right value (of new column field) in the user user grid.
    ...
    "get-managed-users" : "SELECT _openidm_id, userName, mail, givenName, sn, matricola, accountStatus FROM managed_user ORDER BY ${unquoted:orderBy} ${unquoted:orderByDir} SKIP ${unquoted:_pagedResultsOffset} LIMIT ${unquoted:_pageSize}",
    "get-managed-users-filtered" : "SELECT _openidm_id, userName, mail, givenName, sn, accountStatus FROM managed_user LET $userNameLike = if((${userName} = ''), '%%', '${unquoted:userName}%'), $mailLike = if((${mail} = ''), '%%', '${unquoted:mail}%'), $snLike = if((${sn} = ''), '%%', '${unquoted:sn}%'), $givenNameLike = if((${givenName} = ''), '%%', '${unquoted:givenName}%') WHERE  userName LIKE $userNameLike AND mail LIKE $mailLike AND sn LIKE $snLike AND givenName LIKE $givenNameLike AND (accountStatus = ${accountStatus} OR ${accountStatus} = '') ORDER BY ${unquoted:orderBy} ${unquoted:orderByDir} SKIP ${unquoted:_pagedResultsOffset} LIMIT ${unquoted:_pageSize}",
    "get-managed-users-count" : "SELECT COUNT() AS total FROM managed_user",
    "get-managed-users-filtered-count" : "SELECT COUNT() AS total FROM managed_user LET $userNameLike = if((${userName} = ''), '%%', '${unquoted:userName}%'), $mailLike = if((${mail} = ''), '%%', '${unquoted:mail}%'), $snLike = if((${sn} = ''), '%%', '${unquoted:sn}%'), $givenNameLike = if((${givenName} = ''), '%%', '${unquoted:givenName}%') WHERE  userName LIKE $userNameLike AND mail LIKE $mailLike AND sn LIKE $snLike AND givenName LIKE $givenNameLike AND (accountStatus = ${accountStatus} OR ${accountStatus} = '')",
    ...
    },
    ...
    "managed_user" : {
    "index" : [
    {
    "propertyName" : "_openidm_id",
    "propertyType" : "string",
    "indexType" : "unique"
    },
    {
    "propertyName" : "userName",
    "propertyType" : "string",
    "indexType" : "unique"
    },
    {
    "propertyName" : "givenName",
    "propertyType" : "string",
    "indexType" : "notunique"
    },
    {
    "propertyName" : "matricola",
    "propertyType" : "string",
    "indexType" : "notunique"
    },
    {
    "propertyName" : "sn",
    "propertyType" : "string",
    "indexType" : "notunique"
    },
    {
    "propertyName" : "mail",
    "propertyType" : "string",
    "indexType" : "notunique"
    },
    {
    "propertyName" : "accountStatus",
    "propertyType" : "string",
    "indexType" : "notunique"
    }
    ...
    }
    }
    
  5. Create new folder mkdir ui/extension/templates/admin and mkdir ui/extension/templates/user
  6. Copy user interface files into ui/extension/templates/admin/ and add matricola to html files
    cp ui/default/enduser/public/templates/admin/AdminUserProfileTemplate.html ui/extension/templates/admin/
    

    cp ui/default/enduser/public/templates/admin/AdminUserRegistrationTemplate.html ui/extension/templates/admin/
    

    cp ui/default/enduser/public/templates/admin/UsersTemplate.html ui/extension/templates/admin/

    cp ui/default/enduser/public/templates/user/UserProfileTemplate.html ui/extension/templates/user/
    
  7. Copy locales file configuration
    cp -r ui/default/enduser/public/locales/en ui/extension/locales/
    

    "user" : {
    "user" : "User",
    ...
    "matricola" : "Matricola",
    ...
    "familyName" : "Last Name",
    ...
    }
    
  8. Edit the ui/default/enduser/public/org/forgerock/openidm/ui/admin/users/UsersView.js
    In this way the new attribute is added to users list grid.
...
        {
            "name": "mail",
            "label": $.t("common.user.email"),
            "formatter": Handlebars.Utils.escapeExpression
        },
        {
            "name": "matricola",
            "label": $.t("common.user.matricola"),
            "formatter": Handlebars.Utils.escapeExpression
        },
        {
            "name": "accountStatus",
...
        $('#gs_mail').val(params.mail);
        $('#gs_matricola').val(params.matricola);
        $('#gs_accountStatus').val(params.accountStatus);
...

Clone this wiki locally