Data Hub Basic

5 Importing User Information

Users can be loaded into Moodle via a CSV file. The name of this file is indicated in the File name field. This is configurable, for example if your record system's user export process produces a file called users.csv, or people.csv, you can type that name in the File name (1) field and save changes. The file name entered here is the file name that Data Hub will import and process from the 'Import file location'.

Currently DH only supports csv files, however subsequent versions will support XML, webservices, etc. At present, you can only choose csv.

2. The user properties mapping table enables you to map the names of user properties from your export file to properties in DH.

Data Hub Basic user property map with tabs

Data Hub Basic user property map

Any of these parameters can be set or updated via the Data Hub import file. If you make changes to any property values, be sure to save your changes with one of the save buttons on the bottom of the screen.

Moodle custom user profile fields will be on the users property map. In DH Basic, the custom user profile fields all start with "profile_field_" then the shortname of the custom field, but this can be configured in the user property map.The following page has additional information about using custom profile fields.

The properties that can be set via the user csv files are listed below with brief descriptions:

idnumber: User's id number.

auth: Enter the user authentication type here. The example below this chart has more information.

username: Username is a required field.

password: Password is a required field.

email: Email is a required field.

firstname: Firstname is a required field.

lastname: Lastname is a required field.

city: City is a required field.

country: The country name should be entered as it would in Moodle, e.g., United States. This is a required field.

maildigest: Enter no digest, complete, or subjects.

autosubscribe: Enter yes or no.

trackforums: Enter yes or no.

timezone:

language: Check the Moodle site for the appropriate entries, use the shortname shown in parentheses. For example, English (en_us).

theme: Enter the shortname of the theme.

screenreader: Enter yes or no.

description: Enter text.

institution: This is an optional field, located in the Optional section of the Moodle user profile.

department: This is an optional field, located in the Optional section of the Moodle user profile.

action: The actions for user files are add, update, disable.

profile_field_coursecode: This is a custom profile field for the site. For this entry, enter "profile_field_coursecode" in the header, then add a value for this profile field in the column for the user.


Authentication (auth): Follow the steps below to find the value that should be entered for different authentications. This is not a required field, if a value is not entered then the default authentication will be used.
  1. Go to the Site Administration block > Users > Authentication > Manage Authentication.
  2. Mouse over (do not click) the Settings link of the authentication type, this will display the url shown in step 3.
  3. The end of the url displays the name that should be entered as a value in the csv file, the example is showing that "alfrescosso" should be entered for the Alfresco SSO authentication.
Manage user authentication setings

The following list is showing the names of standard authentications and the entries that should be made for each authentication in the csv file.

Authentication Names CSV Entries
Manual accounts manual
No login nologin
Email-based self-registration email
Dummy authentication plugin for ELIS elis
Dummy authentication plugin for Mahara mahara
Moodle Network authentication mnet
Alfresco SSO alfrescosso
OpenID openid
CAS server cas
Curriculum Management System Authorization crlm
External database db
FirstClass server fc
IMAPserver imap
LDAP server ldap
NNTP server nntp
No authentication none
PAM (Pluggable Authentication Modules) pam
POP3 server pop3
Radius server radius
Shibboleth shibboleth


Required Fields


The required fields for importing user files are:
  1. username
  2. password
  3. firstname
  4. lastname
  5. email
  6. city
  7. country
  8. execute/action

Data Hub Actions


The 'execute' field from the image above is represented by the 'action' column in the CSV files. DH tells Moodle what needs to be done with imported data via the Actions column. The following actions can be performed for users:
  1. add - add a user
  2. update - update a user
  3. disable - disable a user - this deletes the user and all of their data.
The sample file below illustrates this function, there is also a link to download this csv file below the image:
Data Hub Basic user file

Select this link to download the sample CSV file used in the example above for adding/updating/disabling users.

The first column of the file contains the action field, which tells DH to add, update, or disable the user. In the file the first two users are being added to the site. The third user is being updated. The fourth user is being disabled, which will delete the user and their records. The actions column enables DH to provide incremental updates, as well as enabling the updating or deleting of users via the automated process.


Password entries:
  • changeme - if changeme is entered for the password, users will be forced to change their passwords when they access the site.
  • * - if * is used for the password, the user will be able to login with * regardless of password requirements.
  • no entry - users with no entry for their password will be added/updated with a blank password, the users will be able to login with only a username.

User.csv file FAQ:

  • What if we send an empty file (no actions in that time period)?
    You will get an error saying that the file was empty, no users will be updated, changed, or deleted.

  • What does it mean to “disable” a user?
    Disabled users are deleted from the system.

  • How is the “add or update user” feature different than doing our own LDAP authentication?

    Data Hub supports user fields (such as custom profile fields) that are not supported by Moodle's LDAP plug-in.

Importing/Processing Data Hub Files

The 'Import file location', specified in the Data Hub block settings, is where the files should be uploaded for processing by Data Hub. To complete the import process for the example above I will follow these steps:

  1. Name the CSV file, for this example it's named 'user.csv'. Make sure the file name shown on the User tab screen is the same, user.csv.

  2. Load the file to the 'Import file location'. The files are automatically processed every 24 hours.

  3. To process the file immediately, select the Save and Process button from the bottom of the screen on the User tab.

Once the file is processed a screen appears describing whether or not the file was processed successfully. Below that there will be a link to the log file.

The log file displays each action taken in the file, with a brief description about the success of the action. For example, if a file of 30 users was processed, then there would be a list describing the action taken for each user's record.

A complete log of all actions is kept in the logs file, as well as (optionally) emailed to an address or addresses each time the DH script runs. The log file location is shown on the settings screen for the Data Hub block. And the option to email the log file to a user is available on the same screen.


* Requires that User themes are enabled in the Admin/Appearance settings of Moodle