Configuring countries available when an attribute has been listed to hold country values is possible with a script provided with the Ubisecure CustomerID installation. The
countrytool script generates a
countries.json file which can further be customized with a text editor if needed.
Using the Country Tool Script
The country tool script generates a
countries.json file based on parameters passed to the script on the command line. The file is put into the configuration directory of Ubisecure CustomerID (
C:\Program Files\Ubisecure\customerid\application\custom or
/usr/local/ubisecure/customerid/application/custom on Windows and Linux respectively).
Invoking the script is done as follows.
The script accepts the following parameters:
- -c, --countries – list of 2-letter ISO country codes to use in the Ubisecure CustomerID installation. E.g. when invoked with parameter "-c fi se" the system supports Finland and Sweden in country type fields. Defaults to all countries.
- -l, --languages – list of 2-letter ISO language codes for localization of country names. I.e. the languages the Ubisecure CustomerID user interface supports. By default Finnish and English.
- -p, --prioritized – list of 2-letter ISO country codes that should be prioritized. By default the country selection list is sorted alphabetically in the current user interface language. If this parameter is given the corresponding countries will be shown first regardless of the alphabetical order.
On a Linux system, for instance, the country tool can be used as follows:
countries.json file, which contains five countries Finland, Sweden, Norway, Denmark and Russia. The names of the countries are stored in Finnish and Swedish and Finland and Sweden would be shown as first options. The configuration file
countries.json is further documented below and can be customized for more complex configurations.
Configuration File countries.json
To get an idea on how the file should look the default countries list is located inside the web application in path
application/webapps/eidm2/WEB-INF/countries.json under the Ubisecure CustomerID installation directory.
The file contains a single JSON array, which contains all the country definitions in separate JSON objects. The JSON objects support the following attributes:
code:Two letter code for the country, use of upper case ISO codes is recommended http://www.iso.org/iso/country_codes/iso_3166_code_lists/country_names_and_code_elements.htm
name:A default name for the country, will be used if no localized version is defined.
priority:Relative priority of the country, the country list in the user interface is sorted first by priority and within each priority group alphabetically. Smaller comes first. If this attribute is omitted, the country has the smallest priority possible.
localized_names:Localized names for the country, which will be shown based on the user interface language selected. The value is a JSON object, keys of which are 2-character language codes and values the respective names. See example.
alternative_names:Alternative names for the country, which will make the country show up in the selector interface. For instance, for The Netherlands it might be good to define Holland as an alternative. This will make The Netherlands show up when user starts typing Holland.
The following example defines three countries and shows all attributes supported:
If you save this file as
countries.json under the customization directory, when an attribute of type COUNTRY is defined, the user interface for editing the attribute will show three countries, namely Finland, Sweden and Norway and show Finland and Sweden as prioritized because they have smaller priority number. The names of the countries are localized for Finnish and English languages and their default names match the countries’ names in their local language.