function pretty_print_ldap_entry in Lightweight Directory Access Protocol (LDAP) 7.2
TODO check if this already exists or find a better place for this function.
Formats a ldap-entry ready to be printed on console. TODO describe preconditions for ldap_entry.
1 call to pretty_print_ldap_entry()
- LdapServer::groupMembershipsFromEntryRecursive in ldap_servers/
LdapServer.class.php - Recurse through all groups, adding parent groups to $all_group_dns array.
File
- ldap_servers/
LdapServer.class.php, line 14 - Defines server classes and related functions.
Code
function pretty_print_ldap_entry($ldap_entry) {
$m = [];
for ($i = 0; $i < $ldap_entry['count']; $i++) {
$k = $ldap_entry[$i];
$v = $ldap_entry[$k];
if (is_array($v)) {
$m2 = [];
$max = $v['count'] > 3 ? 3 : $v['count'];
for ($j = 0; $j < $max; $j++) {
$m2[] = $v[$j];
}
$v = "(" . join(", ", $m2) . ")";
}
$m[] = $k . ": " . $v;
}
return join(", ", $m);
}