@@ -312,7 +312,7 @@ public function fetchUserData($attributes = "")
312
312
}
313
313
314
314
/**
315
- * @param string $searchFor Search-Term
315
+ * @param string|null $searchFor Search-Term
316
316
* @param array|null $attributes Attributes to get back
317
317
* @param string|null $searchFilter Filter string. Set %searchFor% als placeholder to search for $searchFor
318
318
* @param integer $domainKey You can provide integer domainkey, this is then used as target domain! Otherwise it searches in all domains
@@ -321,7 +321,7 @@ public function fetchUserData($attributes = "")
321
321
* @return array|false An Array with the results, indexed by their SID - false if an ERROR occured!
322
322
* @throws \InvalidArgumentException
323
323
*/
324
- public function searchUser (string $ searchFor , $ attributes = "" , $ searchFilter = "" , bool $ domainKey = false , bool $ onlyActiveAccounts = false , bool $ allDomainsHaveToBeReachable = false )
324
+ public function searchUser (? string $ searchFor , ? array $ attributes = [], ? string $ searchFilter = "" , bool $ domainKey = false , bool $ onlyActiveAccounts = false , bool $ allDomainsHaveToBeReachable = false )
325
325
{
326
326
327
327
if (empty ($ attributes )) {
@@ -338,7 +338,7 @@ public function searchUser(string $searchFor, $attributes = "", $searchFilter =
338
338
}
339
339
340
340
if (empty ($ searchFilter )) {
341
- $ searchFilter = "(&(objectCategory=person) " . $ onlyActive . " (|(objectSid=%searchFor%)(sIDHistory=%searchFor%)(samaccountname=*%searchFor%*)(mail=*%searchFor%*)(sn=*%searchFor%*)(givenName=*%searchFor%*)(l=%searchFor%)(physicalDeliveryOfficeName=%searchFor%))) " ;
341
+ $ searchFilter = "(&(objectCategory=person) % onlyActive% (|(objectSid=%searchFor%)(sIDHistory=%searchFor%)(samaccountname=*%searchFor%*)(mail=*%searchFor%*)(sn=*%searchFor%*)(givenName=*%searchFor%*)(l=%searchFor%)(physicalDeliveryOfficeName=%searchFor%))) " ;
342
342
}
343
343
344
344
if (empty ($ searchFor ) && strpos ($ searchFilter , '%searchFor% ' ) !== false ) {
@@ -372,7 +372,7 @@ public function searchUser(string $searchFor, $attributes = "", $searchFilter =
372
372
continue ;
373
373
}
374
374
375
- $ searchFilter = str_replace ("%searchFor% " , addslashes ($ searchFor ), $ searchFilter );
375
+ $ searchFilter = str_replace ([ "%searchFor% " , " %onlyActive% " ], [ addslashes ($ searchFor ), $ onlyActive ] , $ searchFilter );
376
376
377
377
Yii::debug ('Search-Filter: ' . $ searchFilter , __METHOD__ );
378
378
@@ -547,7 +547,7 @@ public static function handleEntry($entry)
547
547
$ count = $ value ['count ' ];
548
548
$ newVal = "" ;
549
549
for ($ i = 0 ; $ i < $ count ; $ i ++) {
550
- $ newVal .= $ value [$ i ];
550
+ $ newVal .= $ value [$ i ]; // Concat? Wouldnt it be better to return an array with all values??
551
551
}
552
552
$ newEntry [$ attr ] = $ newVal ;
553
553
}
0 commit comments