Skip to content

sjsmit/CSV_User_Import-portlet

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

This is a control panel Liferay portlet you can use to import and create portal users from a CSV file.

How to use

  1. Prepare the CSV file (see below for the CSV header that is mandatory)
  2. Optionally select the regular role and/or the organization to assign to the imported users
  3. Upload the file
  4. Done!
The import process checks that the screen name and the email address are unique. If a user with a non unique username or email is present in the csv file, that user will be skipped and after the import process completes they'll be shown in a table. With the Configuration page of the portlet you can control some options and, if they are configured, you can also import your Liferay user custom fields.

The CSV file

The first line in the CSV file is mandatory and is exactly the following:
username;email;firstName;lastName;password;male;jobTitle;birthday;cf1;cf2;cf3;cf4;cf5;cf6;cf7;cf8;cf9;cf10;cf11;cf12;cf13;cf14;cf15;cf16;cf17;cf18;cf19;cf20

The separator could be a semicolon ";" or a comma ",". You can change it from the Configuration page.
The default is a semicolon ";".

The columns

The column username will be the Lifeary users's Screen Name and is mandatory.
The column email will be the Lifeary users's Email and is mandatory.
The column firstName will be the Lifeary users's First name and is mandatory.
The column lastName will be the Lifeary users's Last name and it could be mandatory (it depends from the Portal Settings->Users->Last name required option).
The column password will be the Lifeary users's password and is mandatory.
The column male will be the Lifeary users's Ses and sould be "true" (for "male") or "false" (for "female"). In the configuration page you can "Ignore" this column.
The column jobTitle will be the Lifeary users's Job title. In the configuration page you can "Ignore" this column.
The column birthday will be the Lifeary users's Birthday. In the configuration page you can "Ignore" this column and set the date format you'll use in the CSV file.
The columns cf1, cf2, ..., cf20 will be mapped to maximun 20 custom fileds. In the configuration page, in the "Custom fields" tab, you can select from the available custom fields, the fields you need to import. In the current box, the first field will be mapped to the cf1 column and so on.

In the configuration page, in the "Basic" tab, you can "Ignore" some columns: the column have to be present in the CSV file, but the corresponding values will be ignored during the import. If the column is marked as "Optional" the corresponding values, if presents, will be registered for the user.

Examples

Here some examples for a CSV file.

Example 1: basic CSV file

username;email;firstName;lastName;password;male;jobTitle;birthday;cf1;cf2;cf3;cf4;cf5;cf6;cf7;cf8;cf9;cf10;cf11;cf12;cf13;cf14;cf15;cf16;cf17;cf18;cf19;cf20
m.rossi;[email protected];Mario;Rossi;qwerty67;;;;;;;;;;;;;;;;;;;;;;;
g.bianchi;[email protected];Gino;Bianchi;qwerty67;;;;;;;;;;;;;;;;;;;;;;;

In the configuration page:
  • "Basic" tab
    • The "CSV separator" is "semicolon".
    • For the fields male, jobTitle and birthday choose the "Ignore" option.
  • "Custom fields" tab
    • The Current box is empty.

Example 2: CSV file with sex, job title and birthday

username;email;firstName;lastName;password;male;jobTitle;birthday;cf1;cf2;cf3;cf4;cf5;cf6;cf7;cf8;cf9;cf10;cf11;cf12;cf13;cf14;cf15;cf16;cf17;cf18;cf19;cf20
m.rossi;[email protected];Mario;Rossi;qwerty67;true;Web Master;16-06-1966;;;;;;;;;;;;;;;;;;;;
g.bianchi;[email protected];Gino;Bianchi;qwerty67;true;SEO Manager;28-12-1980;;;;;;;;;;;;;;;;;;;;

In the configuration page:
  • "Basic" tab
    • The "CSV separator" is "semicolon".
    • For the fields male, jobTitle and birthday choose the "Otional" option.
    • For the field "birthday" choose the "dd-MM-yyyy" date format option.
  • "Custom fields" tab
    • The Current box is empty.

Example 3: CSV file with sex, NO job title, birthday and 2 custom fields

In your portal you have 2 custom fields defined for the User entity:
  • Crmcod is a "Text" type custom field you want to use in order to store the external CRM code number
  • Skills is a "Group of Text Values" type custom field you want to use in order to store the technical skills the user has. (One or more in: Android Sdk,ASP.NET,Objective C,J2EE,Java,Php)
username;email;firstName;lastName;password;male;jobTitle;birthday;cf1;cf2;cf3;cf4;cf5;cf6;cf7;cf8;cf9;cf10;cf11;cf12;cf13;cf14;cf15;cf16;cf17;cf18;cf19;cf20
m.rossi;[email protected];Mario;Rossi;qwerty67;true;;16-06-1966;crm1245;"Android Sdk,ASP.NET";;;;;;;;;;;;;;;;;;
g.bianchi;[email protected];Gino;Bianchi;qwerty67;true;;28-12-1980;crm782-a;"Objective C,J2EE,Php";;;;;;;;;;;;;;;;;;

Please note the quotes enclosing the cf2 column values that will be imported into the "Skill" field.
In the configuration page:
  • "Basic" tab
    • The "CSV separator" is "semicolon".
    • For the fields male and birthday choose the "Otional" option.
    • For the field "jobTitle" choose the "Ignore" option.
    • For the field "birthday" choose the "dd-MM-yyyy" date format option.
  • "Custom fields" tab
    • The Current box contains if the exact order (from top to down) Crmcod and Skills.

Requirements and info

This portlet is based on the original work of Paul Butenko (tks Paul).
http://java-liferay.blogspot.it/2012/09/how-to-make-users-import-into-liferay.html
It uses SuperCSV java package.
This portlet is for the 6.2.0-GA1 CE and for EE version of Liferay. Here in the Liferay Marketplace you can download the portlet for previous Liferay versions.

About

A Liferay portlet to import users from a CSV file.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%