Users import
OpenLMIS enables bulk creation/updating of users and user roles through file imports.
Create a file named user.csv
Ensure the file contains the following column headers:
username - username
firstName - user’s first name
lastName - user’s last name
email - user’s email
isEmailVerified - determines whether email is already verified
phoneNumber - user’s phone number
jobTitle - user’s job title
homeFacilityCode - user’s home facility code
timezone - user’s timezone code
isActive - determines whether the user is enabled/disabled. Possible values: true or false
If you want to update data of existing users you can export the users first and use this file as a starting point to make necessary changes.
Save this file with the name user.csv. It must be in .csv format.
Create a .zip file containing the user.csv file. The .zip file name does not matter.
Example file might look like this:
Go to the Administration panel and select Data Import
Select Users from the drop-down menu.
Click Select File and choose your .zip file created in point 4.
Click the Import button located at the bottom-right corner of the page.
A panel will appear with an import summary. You will see information with import results like how many entries have been saved, how many have not been saved and any error information that occurred during import.
IMPORTANT NOTES:
User password - we do not provide the password in the .csv file to avoid providing sensitive data in an open manner. Passwords for each user are set automatically. The default password is: password - but it is a configurable variable and can be changed in environment variables (USER_IMPORT_DEFAULT_PASSWORD). Default password is set automatically for new and existing users. After the importing process, the user should change the password to his own.
Data overwriting for existing users - please be aware that if you do not provide all user’s data in .csv file then existing data will be overwritten by data from file. For example if you already have a user with username diego1 and this user has 111222333 phone number and you provide an empty phone number in the file for this user, then this empty phone number will be saved in the user's contact details.
File pre-validation - before the import process input file is validated - there are some pre-checks performed:
It checks if any file entry does not have mandatory fields - username, firstName or lastName
It checks if file does not contain any duplicated username or email
It checks if all emails have correct format
It checks if any of following: username, email, phoneNumber, timezone, jobTitle does not exceed maximum length of characters (255)
If any of the above fails, the user will get an information message about what went wrong. The user must correct the file content and perform the import again.
How to import user roles data?
Create a file named roleAssignment.csv
Ensure the file contains the following column headers:
username - username for which roles will be added
roleName - name of role
programCode - code of program
warehouseCode - code of facility
supervisoryNodeCode - code of supervisory node
type - role type. Possible values: supervision, fulfillment, direct
If you want to update data of existing user roles you can export the user roles first and use this file as a starting point to make necessary changes.
Save this file with the name roleAssignment.csv. It must be in .csv format.
Create a .zip file containing roleAssignment.csv file. The .zip file name does not matter. You can create .zip file with both files - user.csv and roleAssignment.csv - it will create users first and then their roles.
Example file might look like this:
Go to the Administration panel and select Data Import
Select Users from the drop-down menu.
Click Select File and choose your .zip file created in point 4.
Click the Import button located at the bottom-right corner of the page.
A panel will appear with an import summary. You will see information with import results like how many entries have been saved, how many have not been saved and any error information that occurred during import.
IMPORTANT NOTES:
Data overwriting for existing users - please be aware that all user’s roles are cleared before adding roles from file so all existing user’s role will be replaced by the roles from .csv file.
File pre-validation - before the import process input file is validated - there are some pre-checks performed:
It checks if any file entry does not have mandatory fields:
username, roleName - these fields can have any value but can not be empty
type - this field can not be empty and must have only one of possible values: supervision, fulfillment, direct
It checks if any file entry of supervision type does not have programCode field blank (supervision role requires program)
It checks if any file entry of fulfilment type does not have warehouseCode field blank (fulfillment role requires warehouse)
Validation during import process - during import process system checks other basic information like:
user with provided username exists
role with provided roleName exists
program with provided programCode exists
facility with provided warehouseCode exists
supervisory node with provided supervisoryNodeCode exists
some roles are not acceptable for given role type
not needed values provided will be ignored - e.g. if we provide programCode for fullfilment role or warehouse for supervision these values will be ignored because are not valid for these roles
If any of the above fails, the user will get an information message about what went wrong. The user must correct the file content and perform the import again.
Related content
OpenLMIS: the global initiative for powerful LMIS software