Skip to content

Commit 28ec178

Browse files
committed
Get all contexts if needed
1 parent 3919991 commit 28ec178

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/LDAPHelper.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,24 @@ function findServerForDn($dn) {
152152
return null;
153153
}
154154

155+
/* get contexts, by default write context */
156+
function getNamingContexts($readContexts = false) {
157+
$servers = $this->Writers;
158+
if ($readContexts) {
159+
$servers = $this->Readers;
160+
}
161+
$contexts = [];
162+
foreach($servers as $server) {
163+
$ctxs = $server->getContext();
164+
foreach ($ctxs as $ctx) {
165+
if (!in_array($ctx, $contexts)) {
166+
$contexts[] = $ctx;
167+
}
168+
}
169+
}
170+
return $contexts;
171+
}
172+
155173
private function connectServer($uri, $bindtype = 'simple', $bindopts = [])
156174
{
157175
$conn = ldap_connect($uri);

0 commit comments

Comments
 (0)