Skip to content. | Skip to navigation

Sections
Personal tools
What is this?
Hi, my name is Tom Lazar and I'm a Plone and Zope developer based in Berlin, Germany and this is my personal and professional (no big difference, really...) website.
 

Batch add Users to Plone

Filed Under:

From the Show-and-Tell-Department

Today I needed to add a bunch of new members to an existing Plone instance and to my dismay and surprise there doesn't seem to be an out-of-the-box method to import users into Plone (nor any readily available third-party-products). So much for Batteries Included... ;-)

Interestingly, Rocky Burt's response to my inquiry on #plone was: "[...]should take only 30min to write a CSV parser that creates the objects using portal_membership, no?"

Well, it did take me a bit longer than that... but not much ;-) So here it is: a little python script to create new Plone users from CSV. To use it you need to do the following:
  1. Create a textfile with your userdata. The format is:
    password;userid;lastname;firstname;email
  2. Log into the ZMI of your site and create a 'File' instance at the root of your plone instance. Give it the id 'users.csv' and the file you just created:

  3. Download the script.
  4. Also at the site root, create a 'Script (Python') instance in the root folder of your plone instance with the id 'importPASfromCSV' and the script you just downloaded. Click the 'Add and Edit' button:

  5. In the following form click on the 'Test' tab:

    This will execute the script and its output will be shown onscreen.
  6. There is no step 6.