Login / Status
developer.Resource
Home . Documentation . Document Library . Extension Manuals
Sponsors
hosted by punkt.deTYPO3 and Open Source Magazine

Chapter 1. EXT: Generic User Import Tool

Extension Key: rs_userimp

Copyright 2005, r.sudhoelter (at) web.de, <r.sudhoelter (at) web.de>

This document is published under the Open Content License

available from http://www.opencontent.org/opl.shtml

The content of this document is related to TYPO3

- a GNU/GPL CMS/Framework available from www.typo3.com

1.1. Introduction

Intended Audience

The Generic User Import Tool might come in handy for all those TYPO3 administrators who are confronted with the tedious task of creating many user accounts.

Surprisingly, there is no user import interface in TYPO3 (<= 3.8.0) and the recommended way of doing so was to fill the database via a direct SQL INSERT statement. This has of course several drawbacks and even imposes some threats:

  1. the database may not be directly accessible via command line or phpMyAdmin

  2. you have no visual feedback on imported or rejected data

  3. no certainty whether the so imported datasets meets all internal TYPO3 requirements (min/max field lengths, disallowed chars, ...)

  4. the user's DB know-how may not be sufficient to issue a direct DB statement at all

  5. DB access rights versus TYPO3 user rights

The only way to solve this was to write a backend module which would allow you to upload, prepare and finally import  user data via CGL compliant methods. All this was wrapped in a straight forward, linear 4 step workflow which almost let's no room for user errors.

At its current state, the Generic User Import Tool is limited to do FE and tt_address user imports, but internally, it is already prepared for BE user imports as well.

The tool (0.2.0) was used to import ~ 15.000 FE users in under 180 seconds.

Screenshots

The tool offers 2 main functions: import of user accounts and rollback (deletion) of previously imported users. The security note summarizes what may happen if you do not carefully read this manual.

Import Step 1: file upload

Here you see the module in general. As you can see: the 4 step workflow is nicely laid out in four tabs (plus an extra info tab) which are only activated once the previous workflow step has been successfully carried out.

After we uploaded a file, the tab gets checked with a green check marker, the next tab is enabled and we see the current file info. Please note that the file upload is handled with TYPO3 standard file functions, so we do not need to care about correct file names and so on, this all is nicely handled by the core.

Import Step 2: import settings

Step 2 requires the user to fill out (or reload previously saved) basic import settings such as field delimiters, preview settings and so on.

After updating or saving the necessary settings, we may proceed with the next step, the field mapping.

Import Step 3: field mapping

This is the main task during the import process: we need to map CSV data fields to DB user data fields. The module supports us during this task with a sophisticated mapping form.

Each CSV data field is presented in a single row, showing its description and example values (both only if present in the CSV) and gives us a dropdown selector from which we may select the corresponding DB value. We don't even have to care about dual mappings or missing mandatory fields - the module takes care of that as well.

The screenshot shows the mapping process for a Outlook Express address file which has 29 data fields. Of course not all of them are useful for us.

After correcting and updating the mapping, we see that we meet all internal import criteria and may continue with step 4, the final import.

Import Step 4: CSV import

Now we are almost done. On the final screen we are reminded to save our settings for later re-use.

By clicking the Import button, all other tab functions are deactivated, the import file gets parsed and imported in its whole and we may review the import result on the Error and Messages tab.

Import Step 5: Errors and Messages

Even if we provided all settings and mapped all necessary fields, import errors might occur. Of course we get errors if the file is corrupted. Further on, based on our import settings, there might be additional errors if for example we deactivated the auto rename feature or we have empty username or password fields. All  messages and errors are displayed on this tab.

Finally, to support administrators in system monitoring tasks, the module logs everything (file uploads and DB actions) to the standard system log:

Rollback

The Generic User Import Tool offers you an automated and secure way to roll back previous import sessions.