|
@@ 269-278 (lines=10) @@
|
| 266 |
|
* @param array $attributes List of specific AD attributes to return. Empty array means return everything. |
| 267 |
|
* @return array |
| 268 |
|
*/ |
| 269 |
|
public function getGroupByGUID($guid, $attributes = []) |
| 270 |
|
{ |
| 271 |
|
$searchLocations = $this->config()->groups_search_locations ?: [null]; |
| 272 |
|
foreach ($searchLocations as $searchLocation) { |
| 273 |
|
$records = $this->gateway->getGroupByGUID($guid, $searchLocation, Zend\Ldap\Ldap::SEARCH_SCOPE_SUB, $attributes); |
| 274 |
|
if ($records) { |
| 275 |
|
return $records[0]; |
| 276 |
|
} |
| 277 |
|
} |
| 278 |
|
} |
| 279 |
|
|
| 280 |
|
/** |
| 281 |
|
* Get a particular AD group's data given a DN. |
|
@@ 287-296 (lines=10) @@
|
| 284 |
|
* @param array $attributes List of specific AD attributes to return. Empty array means return everything. |
| 285 |
|
* @return array |
| 286 |
|
*/ |
| 287 |
|
public function getGroupByDN($dn, $attributes = []) |
| 288 |
|
{ |
| 289 |
|
$searchLocations = $this->config()->groups_search_locations ?: [null]; |
| 290 |
|
foreach ($searchLocations as $searchLocation) { |
| 291 |
|
$records = $this->gateway->getGroupByDN($dn, $searchLocation, Zend\Ldap\Ldap::SEARCH_SCOPE_SUB, $attributes); |
| 292 |
|
if ($records) { |
| 293 |
|
return $records[0]; |
| 294 |
|
} |
| 295 |
|
} |
| 296 |
|
} |
| 297 |
|
|
| 298 |
|
/** |
| 299 |
|
* Return all AD users in configured search locations, including all users in nested groups. |
|
@@ 332-341 (lines=10) @@
|
| 329 |
|
* @param array $attributes List of specific AD attributes to return. Empty array means return everything. |
| 330 |
|
* @return array |
| 331 |
|
*/ |
| 332 |
|
public function getUserByGUID($guid, $attributes = []) |
| 333 |
|
{ |
| 334 |
|
$searchLocations = $this->config()->users_search_locations ?: [null]; |
| 335 |
|
foreach ($searchLocations as $searchLocation) { |
| 336 |
|
$records = $this->gateway->getUserByGUID($guid, $searchLocation, Zend\Ldap\Ldap::SEARCH_SCOPE_SUB, $attributes); |
| 337 |
|
if ($records) { |
| 338 |
|
return $records[0]; |
| 339 |
|
} |
| 340 |
|
} |
| 341 |
|
} |
| 342 |
|
|
| 343 |
|
/** |
| 344 |
|
* Get a specific AD user's data given a DN. |
|
@@ 351-360 (lines=10) @@
|
| 348 |
|
* |
| 349 |
|
* @return array |
| 350 |
|
*/ |
| 351 |
|
public function getUserByDN($dn, $attributes = []) |
| 352 |
|
{ |
| 353 |
|
$searchLocations = $this->config()->users_search_locations ?: [null]; |
| 354 |
|
foreach ($searchLocations as $searchLocation) { |
| 355 |
|
$records = $this->gateway->getUserByDN($dn, $searchLocation, Zend\Ldap\Ldap::SEARCH_SCOPE_SUB, $attributes); |
| 356 |
|
if ($records) { |
| 357 |
|
return $records[0]; |
| 358 |
|
} |
| 359 |
|
} |
| 360 |
|
} |
| 361 |
|
|
| 362 |
|
/** |
| 363 |
|
* Get a specific user's data given an email. |
|
@@ 369-378 (lines=10) @@
|
| 366 |
|
* @param array $attributes List of specific AD attributes to return. Empty array means return everything. |
| 367 |
|
* @return array |
| 368 |
|
*/ |
| 369 |
|
public function getUserByEmail($email, $attributes = []) |
| 370 |
|
{ |
| 371 |
|
$searchLocations = $this->config()->users_search_locations ?: [null]; |
| 372 |
|
foreach ($searchLocations as $searchLocation) { |
| 373 |
|
$records = $this->gateway->getUserByEmail($email, $searchLocation, Zend\Ldap\Ldap::SEARCH_SCOPE_SUB, $attributes); |
| 374 |
|
if ($records) { |
| 375 |
|
return $records[0]; |
| 376 |
|
} |
| 377 |
|
} |
| 378 |
|
} |
| 379 |
|
|
| 380 |
|
/** |
| 381 |
|
* Get a specific user's data given a username. |
|
@@ 387-396 (lines=10) @@
|
| 384 |
|
* @param array $attributes List of specific AD attributes to return. Empty array means return everything. |
| 385 |
|
* @return array |
| 386 |
|
*/ |
| 387 |
|
public function getUserByUsername($username, $attributes = []) |
| 388 |
|
{ |
| 389 |
|
$searchLocations = $this->config()->users_search_locations ?: [null]; |
| 390 |
|
foreach ($searchLocations as $searchLocation) { |
| 391 |
|
$records = $this->gateway->getUserByUsername($username, $searchLocation, Zend\Ldap\Ldap::SEARCH_SCOPE_SUB, $attributes); |
| 392 |
|
if ($records) { |
| 393 |
|
return $records[0]; |
| 394 |
|
} |
| 395 |
|
} |
| 396 |
|
} |
| 397 |
|
|
| 398 |
|
/** |
| 399 |
|
* Get a username for an email. |