Wiki source code of Outil d’importation d'utilisateurs
Last modified by jhurst on 2021/11/15 09:22
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | (% class="wikigeneratedid" %) | ||
2 | **Table of contents** | ||
3 | |||
4 | {{toc/}} | ||
5 | |||
6 | ---- | ||
7 | |||
8 | = Description = | ||
9 | |||
10 | **importtools **is a tool to manage users in DigDash’s LDAP. It is particularly useful when handling a big user base. | ||
11 | |||
12 | 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) | ||
13 | |||
14 | or | ||
15 | |||
16 | 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). | ||
17 | |||
18 | java -jar importtools.jar [-conf configfile] [-users userfile] [-out outputfile] | ||
19 | |||
20 | With this tool, you can then administrate your users via the following operations. | ||
21 | |||
22 | = Importing users = | ||
23 | |||
24 | The tool needs two input files : | ||
25 | |||
26 | * 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. | ||
27 | * 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. | ||
28 | |||
29 | And one output file : | ||
30 | |||
31 | * 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. | ||
32 | |||
33 | |=Tag|=Description | ||
34 | |**-conf** <config file>|Path of the XML configuration file. By default, conf.xml | ||
35 | |**-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. | ||
36 | |**-out** <outputfile>|Path of the XML output file that maps with LDAP’s structure. By default, out.xml. | ||
37 | |**-help**|Command usage. | ||
38 | |**-debug**|Shows stack traces when fails. | ||
39 | |**-import**|Sends the output file (by default, out.xml) to the server to import in LDAP. | ||
40 | |**-importonly**|Uses an already existing output file (by default out.xml) and sends it to the server to import in LDAP. | ||
41 | |**-server**|Digdash server address. | ||
42 | |**-user**|The supervisor user. | ||
43 | |**-pass**|The supervisor user’s password | ||
44 | |||
45 | = Removing users = | ||
46 | |||
47 | It is possible to remove all or a part (depending on conditions) of the users in LDAP. | ||
48 | |||
49 | |=Tag|=Description | ||
50 | |**-removeall**|Removes ALL users in LDAP AND license. | ||
51 | |(% style="color:#2ecc71" %)**//Before 2020R2 patch 20210302 ~://**| | ||
52 | |**-removeall -attr=**"ldap attribute name" **-regexp=**"attribute value or regular expression"|Removes all users whose specified ldap attribute value matches the regular expression. | ||
53 | |**-removeall -license_type=**"all.missing.forbidden.[user type]"|((( | ||
54 | Delete all users according to their type or status in the license: | ||
55 | |||
56 | * **all** : all user types/status | ||
57 | * **missing **: missing users from the license | ||
58 | * **forbidden** : unallowed users | ||
59 | * **[user type]** : possible values are **named**, **extranet**, **concurrent**, **public**, **broadcast**. | ||
60 | None, one or many values are possible, separated with the character "." | ||
61 | Samples: named.extranet or missing.extranet.named | ||
62 | |||
63 | At least one of these parameters must be used. | ||
64 | ))) | ||
65 | |(% style="color:#2ecc71" %)**//Avant 2020R2 patch 20210302 ~://**| | ||
66 | |**-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. | ||
67 | |**-removeall** **-attr** "license_type" **-regexp** "extranet"|Special case : removes users in LDAP AND license if the license type is “extranet”. | ||
68 | |(% colspan="2" %)**Exportation** | ||
69 | |**-export**|Exports all LDAP users in a CSV file. By default, export file is named “users_export.csv”. | ||
70 | |**-exportfile** "file.csv"|Exports all users in a CSV named according to the specified absolute path (preceded by **-export**). | ||
71 | |||
72 | = Exporting users = | ||
73 | |||
74 | It is possible to export the users from LDAP. | ||
75 | |||
76 | **Options:** | ||
77 | |||
78 | |=Tag|=Description | ||
79 | |**-export**|Exports all LDAP users in a CSV file. By default, export file is named “users_export.csv”. | ||
80 | |**-exportfile** "file.csv"|Exports all users in a CSV named according to the specified absolute path (preceded by **-export**). | ||
81 | |||
82 | (% class="wikigeneratedid" %) | ||
83 | = General parameters = | ||
84 | |||
85 | |(% colspan="2" %)**Logs** | ||
86 | |**-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. | ||
87 | |**-log** "C:\log.txt"|The log file will be created in the specified directory and with the specified name. | ||
88 | |(% colspan="2" %)**Autres** | ||
89 | |**-loginForm**|Forces the LDAP authentication in SSO case. | ||
90 | |||
91 | = Examples = | ||
92 | |||
93 | * **java -jar importtools.jar** | ||
94 | * **java -jar importtools.jar -conf conf.xml -users users.xls -out out.xml** | ||
95 | * **java -jar importtools.jar -conf conf.xml -users users.xls -out out.xml -import -server http:~/~/localhost:8080 -domain ddenterpriseapi -user admin -pass admi** | ||
96 | * **java -jar importtools.jar -export -server http:~/~/localhost:8080 -domain ddenterpriseapi -user admin -pass admin** | ||
97 | * **java -jar importtools.jar -export -exportfile "D:\my_users_export.csv" -server http:~/~/localhost:8080 -domain ddenterpriseapi -loginForm -user admin -pass admin** | ||
98 | * **java -jar importtools.jar -removeall -server http:~/~/localhost:8080 -domain ddenterpriseapi -user admin -pass admin** | ||
99 | * **java -jar importtools.jar -removeall -attr "license_type" -regexp "extranet" -server http:~/~/localhost:8080 -domain ddenterpriseapi -user admin -pass admin** | ||
100 | * **java -jar importtools.jar -removeall -attr "uid" -regexp "toto1[0-9]*" -server http:~/~/localhost:8080 -domain ddenterpriseapi -user admin -pass admin** |