Private GIT

Skip to content
Snippets Groups Projects
Commit ceede4f2 authored by Kevin Duret's avatar Kevin Duret
Browse files

fix(ldap): remove contact password if ldap password storage is disabled

parent de6a5930
No related branches found
No related tags found
No related merge requests found
...@@ -922,6 +922,10 @@ class CentreonLdapAdmin ...@@ -922,6 +922,10 @@ class CentreonLdapAdmin
$this->db->query($query); $this->db->query($query);
} }
$this->updateLdapServers($arId); $this->updateLdapServers($arId);
/* Remove contact passwords if store password option is disabled */
$this->manageContactPasswords($arId);
return $arId; return $arId;
} }
...@@ -1229,4 +1233,29 @@ class CentreonLdapAdmin ...@@ -1229,4 +1233,29 @@ class CentreonLdapAdmin
} }
return $arr; return $arr;
} }
/**
* Remove contact passwords if password storage is disabled
*
* @param int $arId | Auth resource id
* @return void
*/
private function manageContactPasswords($arId)
{
$result = $this->db->query(
'SELECT ari_value ' .
'FROM auth_ressource_info ' .
'WHERE ar_id = ' . $this->db->escape($arId) . ' ' .
'AND ari_name = "ldap_store_password" '
);
if ($row = $result->fetchRow()) {
if ($row['ari_value'] == '0') {
$this->db->query(
"UPDATE contact " .
"SET contact_passwd = NULL " .
"WHERE ar_id = " . $this->db->escape($arId)
);
}
}
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment