Using the CSV File User Replicator

The CSV replicator is intended for the download of users, cost centres, and/or user roles from pre-defined CSV files and for storing this information in the SafeQ server internal database. In this case, authentication is via the internal database.

The configuration is typically defined on the master CML server only.

At a glance

Following steps are needed to enable CSV file replication:

  1. Configure replication source directory by editing the csv_dir configuration property through System Settings page if necessary (default: <SAFEQ_DIR>\server\csv).

  2. Create CSV files according to the structure described in the next chapter. The CSV File encoding should be UTF-8.

  3. Start replicator by running command line script <SAFEQ_DIR>\bin\csv_import.bat.
    images/s/-3eliqb/8502/404359a7d2ab19c9c7c58d12013124a386b28257/_/images/icons/emoticons/lightbulb_on.svg NOTE: For regular synchronization with the CSV file, schedule the import via system scheduled tasks. To avoid pause at the end of the run, add the -nopause parameter.
    images/s/-3eliqb/8502/404359a7d2ab19c9c7c58d12013124a386b28257/_/images/icons/emoticons/lightbulb_on.svg NOTE: Information about replication results will be saved in log file (CSVReplicator.log) stored in <SAFEQ_DIR>\logs.

CSV file structure

Before replication, the respective CSV files must be stored in the directory named in the csv_dir configuration parameter (initially, <SAFEQ_DIR>\server\csv).
These files must be stored in the format shown below. The files are processed in alphabetical order based on their names. (For replication, only some of them may be used.)

images/s/-3eliqb/8502/404359a7d2ab19c9c7c58d12013124a386b28257/_/images/icons/emoticons/lightbulb_on.svg NOTE: Only one type of input information per file is allowed. E.g. you cannot import users and update card numbers in the same csv file.
images/s/-3eliqb/8502/404359a7d2ab19c9c7c58d12013124a386b28257/_/images/icons/emoticons/lightbulb_on.svg NOTE: CSV files must be imported in logical order. E.g. users must be created before card is assigned to them.
images/s/-3eliqb/8502/404359a7d2ab19c9c7c58d12013124a386b28257/_/images/icons/emoticons/lightbulb_on.svg NOTE: CSV file user replicator is not able to create/modify the money accounts in YSoft Payment System.

The following input types are supported:

  • User information

  • Card numbers

  • Cost centers

  • Roles

  • Mapping roles to users

  • Update of users

  • Deletion of users

  • Set user's password

Replication of complete user list

Replicates the complete list of all users created from an external source.

<user ID>;<login,alias,...>;<first name>;<last name>;<email>;<centre number>

The replication has the following features:

  • If the userID equals zero, then user is updated based on the login (first record). Otherwise, the user with ID matching the userID is updated.

  • If the replicator finds existing user, the replicator compares existing records. In case of changes, it updates relevant data (and adds and/or removes data).

  • If the replicator does not find any user, new one is created. The user ID for the new user is added by database sequence, not by userID specified in CSV!

  • Records not present in the list will be marked as deleted.

PIN or Card number update

Adds additional information to an existing list of users (internal and/or replicated from another source).

<login>;<PIN/card number>
  • New PINs or card numbers will be added to corresponding records.

  • PINs or Card numbers not specified in the list will be deleted.

  • Empty fields in place of a PIN / card number imply the removal of all associated records.

  • PINs or Card numbers imported in another way (e.g. using internal DB/LDAP replication) will remain unchanged.

  • When importing PIN number already encrypted via MD5 add tag md5@@ before whole PIN

    • e.g. jondoe;md5@@PINe10adc3949ba59abbe56e057f20f883e

Cost Centre list replication

List of all cost centers to be replicated to the internal database.

DEPT;<centre number>;<centre name>
  • Centers not included in the list will be removed (marked as deleted).

  • Other cost centers will be added and/or updated.

Role list replication

List of all roles to be replicated to the internal database.

ROLE;<role name>;<role description>
  • Roles not included in the list will be removed (marked as deleted).

  • Other roles will be added and/or updated.

Assignment of user to role

The list of roles the user has been assigned to.

RMAP;<login>;<role name>
  • A login with 3 roles will have 3 records, each line for one role.

  • Only roles in the list will be kept for user (plus the role Everyone); the others will be removed.

Set password for user

This replication type can be used to initialize password for replicated (or any other) users.

Password is set only if user does not have any. This should prevent situation when next replication overwrite the current user's password that user choose instead of the default one (for example via Dashboard widget, if password change action is enabled via his user's rights).

PASSWORD;<login>;<password>
  • Password can't be empty and must be entered as plain text

Update of users

While the replication of users require list of all users (not listed users are deleted), update of users updates only particular user.

USERUPDATE;[userID];[login,alias,...];[name];[surname];[email];[centre number];[home directory]
  • If userID is not empty, user is searched by her ID. Otherwise user is searched by login.

  • Parameters can be empty. Only filled values are updated for the user.

Deletion of users

While the replication of users deletes all not listed users, deletion of users deletes only particular user.

USERDELETE;[userID];[login,alias,...]
  • If userID is not empty, user is deleted based on her ID. Otherwise user is deleted based on login.