Last modified by Aurelie Bertrand on 2025/02/18 11:05

Hide last authors
jhurst 1.1 1 {{ddtoc/}}
2
3 ----
4
5 = **{{id name="__RefHeading___Toc1848_2652393712"/}}**Description =
6
Aurelie Bertrand 23.1 7 **importtools **is a tool for managing users in DigDash LDAP. It is particularly useful for managing a large user base.
jhurst 1.1 8
Aurelie Bertrand 23.1 9 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)
jhurst 1.1 10
Aurelie Bertrand 23.1 11 or
jhurst 1.1 12
Aurelie Bertrand 23.1 13 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).
jhurst 1.1 14
mperroud 2.1 15 (% class="box infomessage" %)
16 (((
jhurst 1.1 17 java -jar importtools.jar [-conf configfile] [-users userfile] [-out outputfile]
mperroud 2.1 18 )))
jhurst 1.1 19
Aurelie Bertrand 23.1 20 = Importing users =
fperrier 9.1 21
Aurelie Bertrand 23.1 22 This mainly involves having two input files:
jhurst 1.1 23
Aurelie Bertrand 23.1 24 * 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).
25 * 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.
jhurst 1.1 26
Aurelie Bertrand 23.1 27 And an output file:
jhurst 1.1 28
Aurelie Bertrand 23.1 29 * 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.
jhurst 1.1 30
31 |=Tag|=Description
Aurelie Bertrand 23.1 32 |**-conf** <config file>|Path to the XML configuration file. By default, conf.xml.
33 |**-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.
34 |**-out** <outputfile>|Path to the XML output file mapping to LDAP. By default, out.xml.
35 |**-help**|Usage help command.
36 |**-debug**|Displays traces of errors.
37 |**-import**|Sends the output file (by default out.xml) to the server for import into LDAP.
38 |**-importonly**|Uses an existing output file (by default, out.xml) and sends it to the server to be imported into LDAP.
39 |**-server**|Address of the DigDash server.
40 |**-domain**|DigDash Enterprise domain name (for example, ddenterpriseapi)
41 |**-user**|The supervisor user.
42 |**-pass**|The password of the supervisor user.
jhurst 1.1 43
Aurelie Bertrand 23.1 44 = {{id name="__RefHeading___Toc476_3721803795"/}}Commands for adding users =
mperroud 7.2 45
Aurelie Bertrand 23.1 46 There are three ways of adding a user to LDAP:
mperroud 7.2 47
48 == create ==
49
Aurelie Bertrand 23.1 50 In this mode the user will be added if, and only if, it does not exist.
51 In other words, with the create command, adding an existing user is an error.
mperroud 7.2 52
53 == overwrite ==
54
Aurelie Bertrand 23.1 55 This command will overwrite an existing user.
56 To be more precise, the user will be deleted before being completely created with the new attributes.
57 If the user does not already exist, it will simply be added.
mperroud 7.2 58
59 == update ==
60
Aurelie Bertrand 23.1 61 This command will update the user with the attributes contained in your import file.
62 The user must already exist. It will not be deleted.
mperroud 7.2 63
Aurelie Bertrand 23.1 64 = {{id name="__RefHeading___Toc476_3721803795"/}}Deleting users =
mperroud 2.1 65
Aurelie Bertrand 23.1 66 You can delete all or some of the users in the DigDash LDAP database.
mperroud 2.1 67
68 |=Tag|=Description
Aurelie Bertrand 23.1 69 |**-removeall**|Deletes ALL users present in LDAP AND the license.
70 |**-removeall -attr=**"ldap attribute name" **-regexp=**"attribute value or regular expression|Removes all users whose specified ldap attribute value checks the regular expression.
71 |**-removeall -license_type=**"all.missing.forbidden.[usertype]"|(((
72 Removes all users according to their type or status in the licence:
mperroud 5.1 73
Aurelie Bertrand 23.1 74 * **all**: all
75 * **missing **: users not in the licence
76 * **forbidden**: users in the licence but not authorised
77 * [**user type]**: possible values are **named**, **extranet**, **concurrent**, **public**, **broadcast**.
78 None, one or more values can be used, separated by a ".".
79 Example: named.extranet or missing.extranet.named
mperroud 5.1 80
Aurelie Bertrand 23.1 81 At least one of these parameters must be used.
mperroud 4.1 82 )))
mperroud 2.1 83
Aurelie Bertrand 23.1 84 = {{id name="__RefHeading___Toc478_3721803795"/}}Exporting users =
mperroud 2.1 85
Aurelie Bertrand 23.1 86 It is possible to export users from the LDAP database.
mperroud 2.1 87
88 **Options :**
89
90 |=Tag|=Description
Aurelie Bertrand 23.1 91 |**-export**|Exports all users to a CSV file. By default, the export file is called users_export.csv.
92 |**-exportfile** "file.csv|Exports all users to the CSV file indicated by its absolute path (preceded by **-export**).
mperroud 2.1 93
jhurst 1.1 94 (% id="HIV.Exemples" %)
Aurelie Bertrand 23.1 95 = {{id name="__RefHeading___Toc1856_2652393712"/}}General parameters =
jhurst 1.1 96
mperroud 3.1 97 |(% colspan="2" %)**Logs**
Aurelie Bertrand 23.1 98 |**-log** "C:\temp"|The log file will be created in the specified directory, named as follows: importtool-yyyy-mm-dd_hh-mm-ss.log.
99 |**-log** "C:\log.txt"|The log file will be created in the directory and under the name specified.
100 |(% colspan="2" %)**Other**
101 |**-loginForm**|Forces LDAP authentication in the SSO case.
mperroud 3.1 102
Aurelie Bertrand 23.1 103 = Examples =
mperroud 3.1 104
jhurst 1.1 105 * **java -jar importtools.jar**
abertrand 9.2 106 * **java -jar importtools.jar -conf ../importtools/conf.xml -users ../importtools/users.xls -out ../importtools/out.xml**
Aurelie Bertrand 23.1 107 * **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**
jhurst 1.1 108 * **java -jar importtools.jar -export -server http:~/~/localhost:8080 -domain ddenterpriseapi -user admin -pass admin**
109 * **java -jar importtools.jar -export -exportfile "D:\my_users_export.csv" -server http:~/~/localhost:8080 -domain ddenterpriseapi -loginForm -user admin -pass admin**
110 * **java -jar importtools.jar -removeall -server http:~/~/localhost:8080 -domain ddenterpriseapi -user admin -pass admin**
111 * **java -jar importtools.jar -removeall -attr "license_type" -regexp "extranet" -server http:~/~/localhost:8080 -domain ddenterpriseapi -user admin -pass admin**
112 * **java -jar importtools.jar -removeall -attr "uid" -regexp "toto1[0-9]*" -server http:~/~/localhost:8080 -domain ddenterpriseapi -user admin -pass admin**
113
Aurelie Bertrand 23.1 114 = Troubleshooting encoding errors on Windows =
abertrand 12.1 115
Aurelie Bertrand 23.1 116 Windows can contain encoding errors. To overcome these errors, you need to add the following command when exporting:
abertrand 12.1 117
118 {{code language="shell"}}
119 -Dfile.encoding=utf-8
120 {{/code}}
121
Aurelie Bertrand 23.1 122 This command is a parameter for JAVA, so you need to place it upstream of the options for importtool.jar. For example:
abertrand 12.1 123
abertrand 14.1 124 {{code language="shell"}}
abertrand 13.1 125 "C:\java.exe" -Dfile.encoding=utf-8 -jar "importtools.jar" %* -export -exportFile "export_.csv" -server https://serveur.digdash.com -domain ddenterpriseapi -user admin -pass "AdminPassWrd"
126 {{/code}}
abertrand 12.1 127
Aurelie Bertrand 23.1 128 = SSL certificate problem =
Aurelie Bertrand 15.1 129
130 (% class="wikigeneratedid" id="HContexte" %)
Aurelie Bertrand 23.1 131 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.
132 You are likely to get the following message when you run the script:
Aurelie Bertrand 15.1 133
134 (% class="box errormessage" %)
135 (((
Aurelie Bertrand 23.1 136 2020-11-09 20:39:34,407 INFO [main] (DDEnterpriseAPIRest.java:1593) - Exception raised (params: clientId=ImportTool, method=login, pass=~*~*~*~*~*~*, user=~#~#~#~##@~#~##.fr): URL download error: https:~/~/~#~##.fr/~#~#~#~#DOMAINE~#~##/DDEnterpriseAuthServlet
Aurelie Bertrand 15.1 137 )))
138
139 (% class="wikigeneratedid" id="HContournement" %)
Aurelie Bertrand 23.1 140 To work around this problem :
Aurelie Bertrand 15.1 141
Aurelie Bertrand 23.1 142 1. Modify the **importools.bat** file **.**
143 1. Add the **-DSSLNoPathCheck=true **parameter before **-jar **as in the example below:
Aurelie Bertrand 15.1 144
145 (% class="box" %)
146 (((
Aurelie Bertrand 23.1 147 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~#~#
Aurelie Bertrand 15.1 148 )))