Last modified by Aurelie Bertrand on 2025/12/19 08:51

Show last authors
1 {{ddtoc/}}
2
3 ----
4
5 = **{{id name="__RefHeading___Toc1848_2652393712"/}}**Description =
6
7 **importtools **is a tool for managing users in DigDash LDAP. It is particularly useful for managing a large user base.
8
9 Importtools can be run directly via the "importtools.bat" command file provided, with default arguments (which can be modified by editing the .bat file)
10 - or -
11 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).
12
13 (% class="box infomessage" %)
14 (((
15 java -jar importtools.jar [-conf configfile] [-users userfile] [-out outputfile]
16 )))
17
18 = Importing users =
19
20 This mainly involves having two input files:
21
22 * 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).
23 * The user file in Excel or CSV format: 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. You can consult the example file [[users_example.xls>>attach:users_example.xls]] and the description of the [[user attributes>>doc:.User_attributes.WebHome]].
24
25 And an output file :
26
27 * 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.
28
29 |=Tag|=Description
30 |**-conf** <config file>|Path to the XML configuration file. By default, conf.xml.
31 |**-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.
32 |**-out** <outputfile>|Path to the XML output file mapping to LDAP. By default, out.xml.
33 |**-help**|Usage help command.
34 |**-debug**|Displays traces of errors.
35 |**-import**|Sends the output file (by default out.xml) to the server for import into LDAP.
36 |**-importonly**|Uses an existing output file (by default, out.xml) and sends it to the server to be imported into LDAP.
37 |**-server**|Address of the DigDash server.
38 |**-domain**|DigDash Enterprise domain name (for example, ddenterpriseapi)
39 |**-user**|The supervisor user.
40 |**-pass**|The password of the supervisor user.
41
42 = {{id name="__RefHeading___Toc476_3721803795"/}}Commands for adding users =
43
44 (% class="box infomessage" %)
45 (((
46 ℹ If a user has an element (role, ACL group and profile) that does not exist at the time of import, the user is still added without this element.
47 )))
48
49 There are three ways of adding a user in LDAP:
50
51 == create ==
52
53 In this mode the user will be added if, and only if, it does not exist.
54 In other words, with the create command, adding an existing user is an error.
55
56 (% class="box" %)
57 (((
58 💡 **Importing user profiles**
59
60 You can import user profiles in create mode in the same way as users.
61 To do this, you can use the same file in Excel or CSV format as for importing users:
62
63 1. In the **uid**, **dn** and **cn** columns, instead of the user name, enter the name of the profiles with the prefix **"dd_profil_**"
64 For example: //"dd_profil_profilA" //with //profileA //the name of the profile.
65 You can view the file [[import_profile.csv>>attach:import_profil.csv]] file as an example.
66 1. Run importtools as normal.
67 ➡ The profiles entered in the file will be created with their associated roles, ACLs, etc.
68 )))
69
70 == overwrite ==
71
72 This command will overwrite an existing user.
73 The user is first deleted, then recreated with the new attributes. If it does not already exist, it is simply added.
74
75 == update ==
76
77 This command updates the user with the attributes present in your import file.
78 The user must already exist. It will not be deleted: its attributes will simply be added to those in the import file.
79
80 = {{id name="__RefHeading___Toc476_3721803795"/}}Deleting users =
81
82 It is possible to delete all or some of the users in the DigDash LDAP database, depending on their criteria.
83
84 |=Tag|=Description
85 |**-removeall**|Removes ALL users present in LDAP AND the license.
86 |**-removeall -attr **"name of LDAP attribute" **-regexp **"value of attribute or regular expression|Removes all users whose specified ldap attribute value checks the regular expression.
87 |**-removeall -license_type **"all.missing.forbidden.[user type]"|(((
88 Removes all users according to their type or status in the licence:
89
90 * **all**: all
91 * **missing **: users not in the licence
92 * **forbidden**: users in the licence but not authorised
93 * [**user type]**: possible values are **named**, **extranet**, **concurrent**, **public**, **broadcast**.
94 None, one or more values can be used, separated by a ".".
95 Example: named.extranet or missing.extranet.named
96
97 At least one of these parameters must be used.
98 )))
99
100 = {{id name="__RefHeading___Toc478_3721803795"/}}Exporting users =
101
102 It is possible to export users from the LDAP database.
103
104 **Options :**
105
106 |=Tag|=Description
107 |**-export**|Exports all users to a CSV file. By default, the export file is called users_export.csv.
108 |**-exportfile** "file.csv|Exports all users to the CSV file indicated by its absolute path (preceded by **-export**).
109
110 (% id="HIV.Exemples" %)
111 = {{id name="__RefHeading___Toc1856_2652393712"/}}General parameters =
112
113 |(% colspan="2" %)**Logs**
114 |**-log** "C:\temp"|The log file will be created in the specified directory, named as follows: importtool-yyyy-mm-dd_hh-mm-ss.log.
115 |**-log** "C:\log.txt"|The log file will be created in the directory and under the name specified.
116 |(% colspan="2" %)**Other**
117 |**-loginForm**|Forces LDAP authentication in the SSO case.
118
119 = Examples =
120
121 * **java -jar importtools.jar**
122 * **java -jar importtools.jar -conf ../importtools/conf.xml -users ../importtools/users.xls -out ../importtools/out.xml**
123 * **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**
124 * **java -jar importtools.jar -export -server http:~/~/localhost:8080 -domain ddenterpriseapi -user admin -pass admin**
125 * **java -jar importtools.jar -export -exportfile "D:\my_users_export.csv" -server http:~/~/localhost:8080 -domain ddenterpriseapi -loginForm -user admin -pass admin**
126 * **java -jar importtools.jar -removeall -server http:~/~/localhost:8080 -domain ddenterpriseapi -user admin -pass admin**
127 * **java -jar importtools.jar -removeall -attr "license_type" -regexp "extranet" -server http:~/~/localhost:8080 -domain ddenterpriseapi -user admin -pass admin**
128 * **java -jar importtools.jar -removeall -attr "uid" -regexp "toto1[0-9]*" -server http:~/~/localhost:8080 -domain ddenterpriseapi -user admin -pass admin**
129
130 = Troubleshooting encoding errors on Windows =
131
132 Windows can contain encoding errors. To overcome these errors, you need to add the following command when exporting:
133
134 {{code language="shell"}}
135 -Dfile.encoding=utf-8
136 {{/code}}
137
138 This command is a parameter for JAVA, so you need to place it upstream of the options for importtool.jar. For example:
139
140 {{code language="shell"}}
141 "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"
142 {{/code}}
143
144 = SSL certificate problem =
145
146 (% class="wikigeneratedid" id="HContexte" %)
147 Running the **importtools **module to import users en masse to a DigDash server protected by an **SSL certificate, **from your local workstation or a workstation that is not the DigDash server, may fail due to incorrect configuration of the SSL certificate.
148 You are likely to get the following message when you run the script:
149
150 (% class="box errormessage" %)
151 (((
152 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
153 )))
154
155 (% class="wikigeneratedid" id="HContournement" %)
156 To work around this problem :
157
158 1. Modify the **importools.bat** file **.**
159 1. Add the **-DSSLNoPathCheck=true **parameter before **-jar **as in the example below:
160
161 (% class="box" %)
162 (((
163 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 ~#~##DOMAINE~#~## -user admin -pass ~#~#PASS~#~#
164 )))