Totara Learn Open Discussions

Este foro de discusión ha sido eliminado.

 
Esta publicación en el foro ha sido eliminada.
Friday, 2 de March de 2018, 03:41
El contenido de esta publicación del foro se ha eliminado y ya no se puede acceder a él.
Craig Eves
Re: Reading deleted users from ldap
de Craig Eves (Totara Support) - Sunday, 4 de March de 2018, 18:56
Grupo Totara
Hi Deva


It looks like someone has answered your post in another forum.

?php
$ldap_host = 'xx.xxx.xx.xxx'; // IP of your LDAP server
$ldap_port = 389;
$ldap_user = 'username'; // user to bind to server
$ldap_pass = '******'; // password
$ldap_context = 'ou=users,dc=example, dc=org'; // where the infos are
// https://stackoverflow.com/questions/36640272/read-deleted-users-from-active-directory
$filter = '(&(objectClass=user)(isDeleted=TRUE))'; $ldap = ldap_connect($ldap_host, $ldap_port);
if (!$ldap) {
die("\nERROR: no connection\n");
} else {
echo "connect OK!\n";
} // https://stackoverflow.com/questions/6222641/how-to-php-ldap-search-to-get-user-ou-if-i-dont-know-the-ou-for-base-dn#6222836
ldap_set_option($ldap, LDAP_OPT_REFERRALS, 0);
ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3); $ldap_bind = ldap_bind($ldap, $ldap_user, $ldap_pass);
if (!$ldap_bind) {
die("\nERROR: can not bind\n");
} else {
echo "bind OK!\n";
} $search = ldap_search($ldap, $ldap_context, $filter);
$info = ldap_get_entries($ldap, $search);
echo "data for " . $info["count"] . " items returned:\n\n"; for ($i=0; $i<$info["count"]; ++$i) {
echo $i + 1, " entry:\n";
echo "dn is: " . $info[$i]["dn"] . "\n";
echo "\n----\n";
} ldap_close($ldap);

It works for me on general searches, but I do not get deleted users (as your link says).

regards

Craig

Esta publicación en el foro ha sido eliminada.
Sunday, 4 de March de 2018, 23:19
El contenido de esta publicación del foro se ha eliminado y ya no se puede acceder a él.