User export and import via the pt CLI command

Requirements

  • Ensure that the pt utility is installed on a Linux host. See guide here

Export current user database

  • From the Linux host, execute
    pt --host 192.168.1.10:8080 --username admin --password 'mypassword' export User > users.yml
  • Evaluate the contents of users.yml to identify the required fields; example below:
    --- !<User>
    active: true
    email: egis1@testserver.com
    login: egis1
    name: Egis1
    properties: {otp: 'false'}
    userType: FULL

Capture new user information

  • Create a csv file with details of the new user accounts to be imported; example cell structure below (remember to convert this to csv):
  • It's a good idea to replace any legitimate - characters with something unique, e.g. 1234567890
active email login name properties userType
true gillb@testserver.com gillb Gill Bates {otp: 'false'} FULL
true joes@testserver.com joes Joe Soap {otp: 'false'} FULL
  • Convert the csv data to YAML. There is a decent online converter here

  • Your YAML output should look like the below:
    ---
    -
    active: true
    email: gillb@testserver.com
    login: gillb
    name: Gill Bates
    properties: {otp: 'false'}
    userType: FULL
    -
    active: true
    email: joes@testserver.com
    login: joes
    name: Joe Soap
    properties: {otp: 'false'}
    userType: FULL

  • Remove the first line ---

  • Perform a simple find-and-replace to substitute - with --- !<User> and your YAML file should now resemble the output from the earlier user database export
  • Ensure that there are no duplicate login values and no illegal characters in any of the fields
  • Replace the string 1234567890 with -

Import new user database

  • Copy your YAML file over to the Linux host (using WinSCP as an option)
  • On the Linux host, execute
    pt --host 192.168.1.10:8080 --username admin --password 'mypassword' import newusers.yml
  • If you encounter any error messages, check the server logs to identify the offending statement (put com.egis.kernel.messaging on DEBUG/TRACE if additional logging is required)

results matching ""

    No results matching ""