Skip to content

Commit

Permalink
Get all contexts if needed
Browse files Browse the repository at this point in the history
  • Loading branch information
artnum committed Aug 13, 2020
1 parent 3919991 commit 28ec178
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/LDAPHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,24 @@ function findServerForDn($dn) {
return null;
}

/* get contexts, by default write context */
function getNamingContexts($readContexts = false) {
$servers = $this->Writers;
if ($readContexts) {
$servers = $this->Readers;
}
$contexts = [];
foreach($servers as $server) {
$ctxs = $server->getContext();
foreach ($ctxs as $ctx) {
if (!in_array($ctx, $contexts)) {
$contexts[] = $ctx;
}
}
}
return $contexts;
}

private function connectServer($uri, $bindtype = 'simple', $bindopts = [])
{
$conn = ldap_connect($uri);
Expand Down

0 comments on commit 28ec178

Please sign in to comment.