Import tools

Last modified by jhurst on 2021/11/15 09:22

Table of contents


Description

importtools is a tool to manage users in DigDash’s LDAP. It is particularly useful when handling a big user base.

The importtools can be directly launched via the provided command file “importtools.bat”, with the arguments by default (that you can modify editing the .bat file)

or

It can be executed via the Java tool “importtools.jar” provided in <digdash_install>\add-ons\tools\lib avec the arguments by default that you can change (see below).

java -jar importtools.jar [-conf configfile] [-users userfile] [-out outputfile]

With this tool, you can then administrate your users via the following operations.

Importing users

The tool needs two input files :

  • The configuration file in XML format : the sample file conf.xml already exists in <digdash_install>\add-ons\tools\importtools ; it contains a list of attributes corresponding to a user’s attributes in LDAP.
  • The users file in Excel or CSV format ; the sample file users.xls already exists in <digdash_install>\add-ons\tools\importtools ; it contains all the users (one user per line) to import in LDAP. Its columns correspond to the attributes in the XML configuration file.

And one output file :

  • The output file in XML format : it is named « out.xml » by default. It is generated after executing the « importtools » with the two previous input files ; the final file is generated so it can map with LDAP’s structure.
TagDescription
-conf <config file>Path of the XML configuration file. By default, conf.xml
-users <excel file / csvfile>Path of the users to import in LDAP as input file. It can be an Excel file or a CSV file. By default, users.xml.
-out <outputfile>Path of the XML output file that maps with LDAP’s structure. By default, out.xml.
-helpCommand usage.
-debugShows stack traces when fails.
-importSends the output file (by default, out.xml) to the server to import in LDAP.
-importonlyUses an already existing output file (by default out.xml) and sends it to the server to import in LDAP.
-serverDigdash server address.
-userThe supervisor user.
-passThe supervisor user’s password

Removing users

It is possible to remove all or a part (depending on conditions) of the users in LDAP.

TagDescription
-removeallRemoves ALL users in LDAP AND license.
Before 2020R2 patch 20210302 : 
-removeall -attr="ldap attribute name" -regexp="attribute value or regular expression"Removes all users whose specified ldap attribute value matches the regular expression.
-removeall -license_type="all.missing.forbidden.[user type]"

Delete all users according to their type or status in the license:

  • all : all user types/status
  • missing : missing users from the license
  • forbidden : unallowed users
  • [user type] : possible values are named, extranet, concurrent, public, broadcast.
    None, one or many values are possible, separated with the character "."
    Samples: named.extranet or missing.extranet.named

At least one of these parameters must be used.

Avant 2020R2 patch 20210302 : 
-removeall -attr "ldap attribut name" -regexp "regexp"Removes all entries in LDAP AND license when specified attribute for a user in LDAP matches the mentioned regular expression.
-removeall -attr "license_type" -regexp "extranet"Special case : removes users in LDAP AND license if the license type is “extranet”.
Exportation
-exportExports all LDAP users in a CSV file. By default, export file is named “users_export.csv”.
-exportfile "file.csv"Exports all users in a CSV named according to the specified absolute path (preceded by -export).

Exporting users

It is possible to export the users from LDAP.

Options:

TagDescription
-exportExports all LDAP users in a CSV file. By default, export file is named “users_export.csv”.
-exportfile "file.csv"Exports all users in a CSV named according to the specified absolute path (preceded by -export).

General parameters

Logs
-log "C:\temp"The log file will be created in the specified directory in the following way: importtool-yyyy-mm-dd_hh-mm-ss.log.
-log "C:\log.txt"The log file will be created in the specified directory and with the specified name.
Autres
-loginFormForces the LDAP authentication in SSO case.

Examples

  • java -jar importtools.jar
  • java -jar importtools.jar -conf conf.xml -users users.xls -out out.xml
  • java -jar importtools.jar -conf conf.xml -users users.xls -out out.xml -import -server http://localhost:8080 -domain ddenterpriseapi -user admin -pass admi
  • 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