|
@@ 284-293 (lines=10) @@
|
| 281 |
|
* @param array $attributes List of specific AD attributes to return. Empty array means return everything. |
| 282 |
|
* @return array |
| 283 |
|
*/ |
| 284 |
|
public function getGroupByGUID($guid, $attributes = []) |
| 285 |
|
{ |
| 286 |
|
$searchLocations = $this->config()->groups_search_locations ?: [null]; |
| 287 |
|
foreach ($searchLocations as $searchLocation) { |
| 288 |
|
$records = $this->gateway->getGroupByGUID($guid, $searchLocation, Ldap::SEARCH_SCOPE_SUB, $attributes); |
| 289 |
|
if ($records) { |
| 290 |
|
return $records[0]; |
| 291 |
|
} |
| 292 |
|
} |
| 293 |
|
} |
| 294 |
|
|
| 295 |
|
/** |
| 296 |
|
* Get a particular AD group's data given a DN. |
|
@@ 302-311 (lines=10) @@
|
| 299 |
|
* @param array $attributes List of specific AD attributes to return. Empty array means return everything. |
| 300 |
|
* @return array |
| 301 |
|
*/ |
| 302 |
|
public function getGroupByDN($dn, $attributes = []) |
| 303 |
|
{ |
| 304 |
|
$searchLocations = $this->config()->groups_search_locations ?: [null]; |
| 305 |
|
foreach ($searchLocations as $searchLocation) { |
| 306 |
|
$records = $this->gateway->getGroupByDN($dn, $searchLocation, Ldap::SEARCH_SCOPE_SUB, $attributes); |
| 307 |
|
if ($records) { |
| 308 |
|
return $records[0]; |
| 309 |
|
} |
| 310 |
|
} |
| 311 |
|
} |
| 312 |
|
|
| 313 |
|
/** |
| 314 |
|
* Return all AD users in configured search locations, including all users in nested groups. |
|
@@ 347-356 (lines=10) @@
|
| 344 |
|
* @param array $attributes List of specific AD attributes to return. Empty array means return everything. |
| 345 |
|
* @return array |
| 346 |
|
*/ |
| 347 |
|
public function getUserByGUID($guid, $attributes = []) |
| 348 |
|
{ |
| 349 |
|
$searchLocations = $this->config()->users_search_locations ?: [null]; |
| 350 |
|
foreach ($searchLocations as $searchLocation) { |
| 351 |
|
$records = $this->gateway->getUserByGUID($guid, $searchLocation, Ldap::SEARCH_SCOPE_SUB, $attributes); |
| 352 |
|
if ($records) { |
| 353 |
|
return $records[0]; |
| 354 |
|
} |
| 355 |
|
} |
| 356 |
|
} |
| 357 |
|
|
| 358 |
|
/** |
| 359 |
|
* Get a specific AD user's data given a DN. |
|
@@ 366-375 (lines=10) @@
|
| 363 |
|
* |
| 364 |
|
* @return array |
| 365 |
|
*/ |
| 366 |
|
public function getUserByDN($dn, $attributes = []) |
| 367 |
|
{ |
| 368 |
|
$searchLocations = $this->config()->users_search_locations ?: [null]; |
| 369 |
|
foreach ($searchLocations as $searchLocation) { |
| 370 |
|
$records = $this->gateway->getUserByDN($dn, $searchLocation, Ldap::SEARCH_SCOPE_SUB, $attributes); |
| 371 |
|
if ($records) { |
| 372 |
|
return $records[0]; |
| 373 |
|
} |
| 374 |
|
} |
| 375 |
|
} |
| 376 |
|
|
| 377 |
|
/** |
| 378 |
|
* Get a specific user's data given an email. |
|
@@ 384-393 (lines=10) @@
|
| 381 |
|
* @param array $attributes List of specific AD attributes to return. Empty array means return everything. |
| 382 |
|
* @return array |
| 383 |
|
*/ |
| 384 |
|
public function getUserByEmail($email, $attributes = []) |
| 385 |
|
{ |
| 386 |
|
$searchLocations = $this->config()->users_search_locations ?: [null]; |
| 387 |
|
foreach ($searchLocations as $searchLocation) { |
| 388 |
|
$records = $this->gateway->getUserByEmail($email, $searchLocation, Ldap::SEARCH_SCOPE_SUB, $attributes); |
| 389 |
|
if ($records) { |
| 390 |
|
return $records[0]; |
| 391 |
|
} |
| 392 |
|
} |
| 393 |
|
} |
| 394 |
|
|
| 395 |
|
/** |
| 396 |
|
* Get a specific user's data given a username. |
|
@@ 402-411 (lines=10) @@
|
| 399 |
|
* @param array $attributes List of specific AD attributes to return. Empty array means return everything. |
| 400 |
|
* @return array |
| 401 |
|
*/ |
| 402 |
|
public function getUserByUsername($username, $attributes = []) |
| 403 |
|
{ |
| 404 |
|
$searchLocations = $this->config()->users_search_locations ?: [null]; |
| 405 |
|
foreach ($searchLocations as $searchLocation) { |
| 406 |
|
$records = $this->gateway->getUserByUsername($username, $searchLocation, Ldap::SEARCH_SCOPE_SUB, $attributes); |
| 407 |
|
if ($records) { |
| 408 |
|
return $records[0]; |
| 409 |
|
} |
| 410 |
|
} |
| 411 |
|
} |
| 412 |
|
|
| 413 |
|
/** |
| 414 |
|
* Get a username for an email. |