@@ 305-314 (lines=10) @@ | ||
302 | * @param array $attributes List of specific AD attributes to return. Empty array means return everything. |
|
303 | * @return array |
|
304 | */ |
|
305 | public function getGroupByGUID($guid, $attributes = []) |
|
306 | { |
|
307 | $searchLocations = $this->config()->groups_search_locations ?: [null]; |
|
308 | foreach ($searchLocations as $searchLocation) { |
|
309 | $records = $this->gateway->getGroupByGUID($guid, $searchLocation, Ldap::SEARCH_SCOPE_SUB, $attributes); |
|
310 | if ($records) { |
|
311 | return $records[0]; |
|
312 | } |
|
313 | } |
|
314 | } |
|
315 | ||
316 | /** |
|
317 | * Get a particular AD group's data given a DN. |
|
@@ 323-332 (lines=10) @@ | ||
320 | * @param array $attributes List of specific AD attributes to return. Empty array means return everything. |
|
321 | * @return array |
|
322 | */ |
|
323 | public function getGroupByDN($dn, $attributes = []) |
|
324 | { |
|
325 | $searchLocations = $this->config()->groups_search_locations ?: [null]; |
|
326 | foreach ($searchLocations as $searchLocation) { |
|
327 | $records = $this->gateway->getGroupByDN($dn, $searchLocation, Ldap::SEARCH_SCOPE_SUB, $attributes); |
|
328 | if ($records) { |
|
329 | return $records[0]; |
|
330 | } |
|
331 | } |
|
332 | } |
|
333 | ||
334 | /** |
|
335 | * Return all AD users in configured search locations, including all users in nested groups. |
|
@@ 368-377 (lines=10) @@ | ||
365 | * @param array $attributes List of specific AD attributes to return. Empty array means return everything. |
|
366 | * @return array |
|
367 | */ |
|
368 | public function getUserByGUID($guid, $attributes = []) |
|
369 | { |
|
370 | $searchLocations = $this->config()->users_search_locations ?: [null]; |
|
371 | foreach ($searchLocations as $searchLocation) { |
|
372 | $records = $this->gateway->getUserByGUID($guid, $searchLocation, Ldap::SEARCH_SCOPE_SUB, $attributes); |
|
373 | if ($records) { |
|
374 | return $records[0]; |
|
375 | } |
|
376 | } |
|
377 | } |
|
378 | ||
379 | /** |
|
380 | * Get a specific AD user's data given a DN. |
|
@@ 387-396 (lines=10) @@ | ||
384 | * |
|
385 | * @return array |
|
386 | */ |
|
387 | public function getUserByDN($dn, $attributes = []) |
|
388 | { |
|
389 | $searchLocations = $this->config()->users_search_locations ?: [null]; |
|
390 | foreach ($searchLocations as $searchLocation) { |
|
391 | $records = $this->gateway->getUserByDN($dn, $searchLocation, Ldap::SEARCH_SCOPE_SUB, $attributes); |
|
392 | if ($records) { |
|
393 | return $records[0]; |
|
394 | } |
|
395 | } |
|
396 | } |
|
397 | ||
398 | /** |
|
399 | * Get a specific user's data given an email. |
|
@@ 405-414 (lines=10) @@ | ||
402 | * @param array $attributes List of specific AD attributes to return. Empty array means return everything. |
|
403 | * @return array |
|
404 | */ |
|
405 | public function getUserByEmail($email, $attributes = []) |
|
406 | { |
|
407 | $searchLocations = $this->config()->users_search_locations ?: [null]; |
|
408 | foreach ($searchLocations as $searchLocation) { |
|
409 | $records = $this->gateway->getUserByEmail($email, $searchLocation, Ldap::SEARCH_SCOPE_SUB, $attributes); |
|
410 | if ($records) { |
|
411 | return $records[0]; |
|
412 | } |
|
413 | } |
|
414 | } |
|
415 | ||
416 | /** |
|
417 | * Get a specific user's data given a username. |
|
@@ 423-432 (lines=10) @@ | ||
420 | * @param array $attributes List of specific AD attributes to return. Empty array means return everything. |
|
421 | * @return array |
|
422 | */ |
|
423 | public function getUserByUsername($username, $attributes = []) |
|
424 | { |
|
425 | $searchLocations = $this->config()->users_search_locations ?: [null]; |
|
426 | foreach ($searchLocations as $searchLocation) { |
|
427 | $records = $this->gateway->getUserByUsername($username, $searchLocation, Ldap::SEARCH_SCOPE_SUB, $attributes); |
|
428 | if ($records) { |
|
429 | return $records[0]; |
|
430 | } |
|
431 | } |
|
432 | } |
|
433 | ||
434 | /** |
|
435 | * Get a username for an email. |