Import

From Swivel Knowledgebase
Jump to: navigation, search


Overview

This document described the User Administration function to import users from a CSV file into Swivel.


Prerequisites

Swivel 3.9 onwards

CSV file


Import users

Import Process

Check the file contents

Zip the file if necessary

On the Swivel Administration console select User Administration

Select the Repository that the users should be imported into, this will be an XML repository, LDAP Writeable or ADAM

An Import button should be available, then click Import.

Select the required import options, with the required file location then click Import

Click on User Sync to import the users from the repository


Import options

Groups: default None, a list of Swivel groups into which the users will be imported, or import groups from file.

File Type: default None, options: CSV XML

File to Import: Browse to import file

File is zipped Tick if the file is zipped. For users greater than 100, a zip file should be used to import the users.

Delete imported users Tick to select, this will delete the users from the source.


Importing a PIN number

It is recommended that Swivel generate a random PIN number that is sent to the user on account creation. However it is possible to import a PIN number for a user as detailed below:


Under Repository -> Attributes, create a new attribute in the empty space at the bottom, called "pin". You need only enter a name for this attribute for the repository you are trying to import into. If this is an XML repository, the attribute name should be "pin". If it is an ADAM or LDAP repository, use the attribute name set as initial PIN attribute.

Next, you need to add "pin" (or the appropriate attribute name) as the header field for the appropriate CSV column, and enter the initial PINs for the imported users.

Import the users from CSV. Note that this only imports the users into the repository. You need to run User Sync in order to import the users into the database. The PINs should be imported as well.


CSV File format

The CSV file should have as its first line the field names to be imported, then the data, with one line per entry, fields separated by a comma.

Examples:

 Username,username,first-name,last-name,email,disabled,phone
 psampr,psampr,Pete,Sampras,user1@email.com,FALSE,12345678
 aagass,aagass,Andre,Agassi,user2@email.com,FALSE,12345678
 rnadal,rnadal,Rafael,Nadal,user3@email.com,FALSE,12345678


 Username,username,first-name,last-name,email,disabled,phone,group_1,group_2
 user1,user1,Pete,Sampras,user1@email.com,FALSE,12345678,group-1,group-2
 user2,user2,Andre,Agassi,user2@email.com,FALSE,12345678,group-1,group-2
 user3,user3,Rafael,Nadal,user3@email.com,FALSE,12345678,group-1,group-2

The attributes in the header should be named as in the target repository, rather than the Sentry attribute names. For XML repositories, these are as follows:

  • username
  • first-name
  • last-name
  • email
  • phone
  • password
  • pin
  • custom
  • custom2
  • custom3
  • custom4
  • custom5

If groups are imported, rather than specified as fixed, use the convention shown in the second example of listing "group_" followed by an index in the header.

Note that username is shown twice in these examples: once as "Username" and once as "username". This is a workaround for an issue recently discovered, which is caused by having a custom attribute named "username". This hides the real Username field from the import, so you get the error "Username not given in header". Once this issue has been resolved, this article will be updated to reflect the resolution.

Testing

Known Issues

Importing existing users

If you try to import users with the same name as existing users, you get an error and the import fails. So to carry out the import again, you will need to delete all the users that you imported previously first.


Importing PIN as an attribute

If PIN has been added as a user attribute, it is displayed in the user administration page, if you view attributes. In the case of XML only, if you carry out a second user sync, the PIN attribute appears empty. However, the user's PIN is not removed.


Troubleshooting