Topic: Usager sans @DOMAIN ?
Bonjour,
Il s'agit de mon premier post ici et je m'excuse par avance si la question a déjà été abordé précédemment mais je ne trouve pas de réponse à mon problème.
Lors de l'import vers GLPI, l'agent FI renseigne le champ "usager" avec samaccountname@DOMAIN, ce qui est assez gênant car cela empêche la liaison des ordinateurs avec les utilisateurs (eux-mêmes importés depuis notre LDAP).
La seule piste que j'ai trouvé en fouillant dans le forum c'est dans le fichier "formatconvert.class.php", section "USERS" (vu dans un topic ici-même mais resté sans réponse depuis 2015...) :
// * USERS
$cnt = 0;
if (isset($array['USERS'])) {
if (count($array['USERS']) > 0) {
$user_temp = '';
if (isset($a_inventory['Computer']['contact'])) {
$user_temp = $a_inventory['Computer']['contact'];
}
$a_inventory['Computer']['contact'] = '';
}
foreach ($array['USERS'] as $a_users) {
$array_tmp = $thisc->addValues($a_users,
[
'LOGIN' => 'login',
'DOMAIN' => 'domain']);
$user = '';
if (isset($array_tmp['login'])) {
$user = $array_tmp['login'];
if (isset($array_tmp['domain'])
&& !empty($array_tmp['domain'])) {
$user .= "@".$array_tmp['domain'];
}
}
if ($cnt == 0) {
if (isset($array_tmp['login'])) {
// Search on domain
$where_add = [];
if (isset($array_tmp['domain'])
&& !empty($array_tmp['domain'])) {
$ldaps = $DB->request('glpi_authldaps',
['WHERE' => "`inventory_domain` = '".$array_tmp['domain']."'"]
);
$ldaps_ids = [];
foreach ($ldaps as $data_LDAP) {
$ldaps_ids[] = $data_LDAP['id'];
}
if (count($ldaps_ids)) {
$where_add['authtype'] = Auth::LDAP;
$where_add['auths_id'] = $ldaps_ids;
}
}
$iterator = $DB->request([
'SELECT' => ['id'],
'FROM' => 'glpi_users',
'WHERE' => [
'name' => $array_tmp['login']
] + $where_add,
'LIMIT' => 1
]);
if ($row = $iterator->next()) {
$a_inventory['Computer']['users_id'] = $row['id'];
}
}
}
if ($user != '') {
if (isset($a_inventory['Computer']['contact'])) {
if ($a_inventory['Computer']['contact'] == '') {
$a_inventory['Computer']['contact'] = $user;
} else {
$a_inventory['Computer']['contact'] .= "/".$user;
}
} else {
$a_inventory['Computer']['contact'] = $user;
}
}
$cnt++;
}
if (empty($a_inventory['Computer']['contact'])) {
$a_inventory['Computer']['contact'] = $user_temp;
}
}
Mais je ne vois pas aller modifier du code PHP, surtout si je dois penser à le faire à chaque upgrade du plugin...
Il existe peut-être une option comme celle empêchant FI de gérer le nom du système d'exploitation mais je ne l'ai pas trouvé...
Avez-vous une solution à ce problème ?
Bonne journée !