Skip to content

Commit 2c1716b

Browse files
committed
Fix Psalm issues (#1)
1 parent 51084b6 commit 2c1716b

3 files changed

Lines changed: 13 additions & 4 deletions

File tree

lib/Auth/Process/AttributeAddUsersGroups.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace SimpleSAML\Module\ldap\Auth\Process;
44

5+
use SimpleSAML\Utils\Arrays;
6+
57
/**
68
* Does a reverse membership lookup on the logged in user,
79
* looking for groups it is a member of and adds them to
@@ -252,7 +254,7 @@ protected function search($memberof)
252254
$get_attributes = [$map['memberof'], $map['type']];
253255
if (isset($map['name']) && $map['name']) {
254256
$get_attributes[] = $map['name'];
255-
$use_group_name = false;
257+
$use_group_name = true;
256258
}
257259

258260
// Check each DN of the passed memberOf
@@ -319,7 +321,7 @@ protected function searchActiveDirectory($dn)
319321
' Member Attribute: '.$map['member'].
320322
' Type Attribute: '.$map['type'].
321323
' Type Value: '.$this->type_map['group'].
322-
' Base: '.implode('; ', $this->base_dn)
324+
' Base: '.implode('; ', Arrays::Arrayize($this->base_dn))
323325
);
324326

325327
// AD connections should have this set

lib/Auth/Process/BaseFilter.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ abstract class BaseFilter extends \SimpleSAML\Auth\ProcessingFilter
4949
* Instance, object of the ldap connection. Stored here to
5050
* be access later during processing.
5151
*
52-
* @var \SimpleSAML\Auth\LDAP
52+
* @var \SimpleSAML\Auth\LDAP|null
5353
*/
54-
private $ldap;
54+
private $ldap = null;
5555

5656

5757
/**
@@ -249,6 +249,7 @@ public function __construct(&$config, $reserved)
249249
);
250250
}
251251

252+
252253
/**
253254
* Getter for the LDAP connection object. Created this getter
254255
* rather than setting in the constructor to avoid unnecessarily
@@ -294,6 +295,7 @@ protected function getLdap()
294295
return $this->ldap;
295296
}
296297

298+
297299
/**
298300
* Local utility function to get details about a variable,
299301
* basically converting it to a string to be used in a log

lib/ConfigHelper.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,10 @@ public function login($username, $password, array $sasl_args = null)
205205
}
206206
}
207207

208+
/**
209+
* PHPdoc changed in SSP 1.18; Remove it after release
210+
* @var string|null $dn
211+
*/
208212
$dn = $ldap->searchfordn(
209213
$this->searchBase,
210214
$this->searchAttributes,
@@ -213,6 +217,7 @@ public function login($username, $password, array $sasl_args = null)
213217
$this->searchFilter,
214218
$this->searchScope
215219
);
220+
216221
if ($dn === null) {
217222
/* User not found with search. */
218223
\SimpleSAML\Logger::info($this->location.': Unable to find users DN. username=\''.$username.'\'');

0 commit comments

Comments
 (0)