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

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 using the "importtools.bat" command file provided, with the default arguments (which can be modified by editing the .bat file)
10
11 or
12
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).
14
15 (% class="box infomessage" %)
16 (((
17 java -jar importtools.jar [-conf configfile] [-users userfile] [-out outputfile]
18 )))
19
20 = Importing users =
21
22 This mainly involves having two input files:
23
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.
26
27 And an output file:
28
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.
30
31 |=Tag|=Description
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.
43
44 = {{id name="__RefHeading___Toc476_3721803795"/}}Commands for adding users =
45
46 There are three ways of adding a user to LDAP:
47
48 == create ==
49
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.
52
53 == overwrite ==
54
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.
58
59 == update ==
60
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.
63
64 = {{id name="__RefHeading___Toc476_3721803795"/}}Deleting users =
65
66 You can delete all or some of the users in the DigDash LDAP database.
67
68 |=Tag|=Description
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:
73
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
80
81 At least one of these parameters must be used.
82 )))
83
84 = {{id name="__RefHeading___Toc478_3721803795"/}}Exporting users =
85
86 It is possible to export users from the LDAP database.
87
88 **Options :**
89
90 |=Tag|=Description
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**).
93
94 (% id="HIV.Exemples" %)
95 = {{id name="__RefHeading___Toc1856_2652393712"/}}General parameters =
96
97 |(% colspan="2" %)**Logs**
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.
102
103 = Examples =
104
105 * **java -jar importtools.jar**
106 * **java -jar importtools.jar -conf ../importtools/conf.xml -users ../importtools/users.xls -out ../importtools/out.xml**
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**
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
114 = Troubleshooting encoding errors on Windows =
115
116 Windows can contain encoding errors. To overcome these errors, you need to add the following command when exporting:
117
118 {{code language="shell"}}
119 -Dfile.encoding=utf-8
120 {{/code}}
121
122 This command is a parameter for JAVA, so you need to place it upstream of the options for importtool.jar. For example:
123
124 {{code language="shell"}}
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}}
127
128 = SSL certificate problem =
129
130 (% class="wikigeneratedid" id="HContexte" %)
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:
133
134 (% class="box errormessage" %)
135 (((
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
137 )))
138
139 (% class="wikigeneratedid" id="HContournement" %)
140 To work around this problem :
141
142 1. Modify the **importools.bat** file **.**
143 1. Add the **-DSSLNoPathCheck=true **parameter before **-jar **as in the example below:
144
145 (% class="box" %)
146 (((
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~#~#
148 )))