User import tool
- Description
- Importing users
- Commands for adding users
- Deleting users
- Exporting users
- General parameters
- Examples
- Troubleshooting encoding errors on Windows
- SSL certificate problem
Description
importtools is a tool for managing users in DigDash LDAP. It is particularly useful for managing a large user base.
importtools can be run directly using the "importtools.bat" command file provided, with the default arguments (which can be modified by editing the .bat file)
or
It can be run via the "importtools.jar" Java tool provided in the <digdash_install>\add-ons\tools\lib folder with default or customisable arguments (see next section).
Importing users
This mainly involves having two input files:
- the configuration file in XML format: the example file conf.xml is delivered in <digdash_install>\add-ons\tools\importtools; It is used to map a column in the users file (see next) to an attribute of an LDAP user in the output file (see next).
- the user file in Excel or CSV format: the example file users.xls is delivered in <digdash_install>\add-ons\tools\importtools; This is the user database (one line per user) to be imported into LDAP. Its columns correspond to the attributes in the XML configuration file.
And an output file:
- the output file in XML format: named "out.xml" by default, it is generated when the "importtools" tool is launched with the two files mentioned above as input; it is generated in such a way as to map onto the LDAP structure.
Tag | Description |
---|---|
-conf <config file> | Path to the XML configuration file. By default, conf.xml. |
-users <excel file / csvfile> | Path to the input file of users to be imported. This can be an Excel file or a CSV file. By default, users.xls. |
-out <outputfile> | Path to the XML output file mapping to LDAP. By default, out.xml. |
-help | Usage help command. |
-debug | Displays traces of errors. |
-import | Sends the output file (by default out.xml) to the server for import into LDAP. |
-importonly | Uses an existing output file (by default, out.xml) and sends it to the server to be imported into LDAP. |
-server | Address of the DigDash server. |
-domain | DigDash Enterprise domain name (for example, ddenterpriseapi) |
-user | The supervisor user. |
-pass | The password of the supervisor user. |
Commands for adding users
There are three ways of adding a user to LDAP:
create
In this mode the user will be added if, and only if, it does not exist.
In other words, with the create command, adding an existing user is an error.
overwrite
This command will overwrite an existing user.
To be more precise, the user will be deleted before being completely created with the new attributes.
If the user does not already exist, it will simply be added.
update
This command will update the user with the attributes contained in your import file.
The user must already exist. It will not be deleted.
Deleting users
You can delete all or some of the users in the DigDash LDAP database.
Tag | Description |
---|---|
-removeall | Deletes ALL users present in LDAP AND the license. |
-removeall -attr="ldap attribute name" -regexp="attribute value or regular expression | Removes all users whose specified ldap attribute value checks the regular expression. |
-removeall -license_type="all.missing.forbidden.[usertype]" | Removes all users according to their type or status in the licence:
At least one of these parameters must be used. |
Exporting users
It is possible to export users from the LDAP database.
Options :
Tag | Description |
---|---|
-export | Exports all users to a CSV file. By default, the export file is called users_export.csv. |
-exportfile "file.csv | Exports all users to the CSV file indicated by its absolute path (preceded by -export). |
General parameters
Logs | |
-log "C:\temp" | The log file will be created in the specified directory, named as follows: importtool-yyyy-mm-dd_hh-mm-ss.log. |
-log "C:\log.txt" | The log file will be created in the directory and under the name specified. |
Other | |
-loginForm | Forces LDAP authentication in the SSO case. |
Examples
- java -jar importtools.jar
- java -jar importtools.jar -conf ../importtools/conf.xml -users ../importtools/users.xls -out ../importtools/out.xml
- java -jar importtools.jar -conf ../importtools/conf.xml -users ../importtools/users.xls -out ../importtools/out.xml -import -server http://localhost:8080 -domain ddenterpriseapi -user admin -pass admin
- java -jar importtools.jar -export -server http://localhost:8080 -domain ddenterpriseapi -user admin -pass admin
- java -jar importtools.jar -export -exportfile "D:\my_users_export.csv" -server http://localhost:8080 -domain ddenterpriseapi -loginForm -user admin -pass admin
- java -jar importtools.jar -removeall -server http://localhost:8080 -domain ddenterpriseapi -user admin -pass admin
- java -jar importtools.jar -removeall -attr "license_type" -regexp "extranet" -server http://localhost:8080 -domain ddenterpriseapi -user admin -pass admin
- java -jar importtools.jar -removeall -attr "uid" -regexp "toto1[0-9]*" -server http://localhost:8080 -domain ddenterpriseapi -user admin -pass admin
Troubleshooting encoding errors on Windows
Windows can contain encoding errors. To overcome these errors, you need to add the following command when exporting:
This command is a parameter for JAVA, so you need to place it upstream of the options for importtool.jar. For example:
SSL certificate problem
Running the importtools module to import users in batch to a DigDash server protected by an SSL certificate, from your local workstation or a workstation that is not the DigDash server, may fail because the SSL certificate has been incorrectly configured.
You are likely to get the following message when you run the script:
To work around this problem :
- Modify the importools.bat file .
- Add the -DSSLNoPathCheck=true parameter before -jar as in the example below:
java -Dlog4j.configuration="file:///%importtoolshome%/import_log4j.properties" -DSSLNoPathCheck=true -jar "%importtoolshome%/importtools.jar" %* -conf conf.xml -users users.xls -out out.xml -import -server https://###.fr -domain ###DOMAIN### -user admin -pass ##PASS##