diff --git a/lib/UESUpdateHelper.php b/lib/UESUpdateHelper.php index 19ea1d636b988cccfaf38e15bc17c862ee486767..f741c61a0a09685877eb4e28ac98d20d8016589c 100644 --- a/lib/UESUpdateHelper.php +++ b/lib/UESUpdateHelper.php @@ -5,6 +5,7 @@ namespace SimpleSAML\Module\perun; use Exception; use SimpleSAML\Configuration; use SimpleSAML\Logger; +use SimpleSAML\Module\perun\Exception as PerunException; class UESUpdateHelper { @@ -82,15 +83,20 @@ class UESUpdateHelper $attrValue = [$attrValue]; } + if (empty($attrValue)) { + continue; + } + foreach ($attrValue as $extLogin) { + if (empty($extLogin)) { + continue; + } $userExtSource = self::getUserExtSource($adapter, $extSourceName, $extLogin); - if ($userExtSource !== null) { Logger::debug( self::DEBUG_PREFIX . 'Found user ext source for combination extSourceName \'' . $extSourceName . '\' and extLogin \'' . $extLogin . '\'' ); - return $userExtSource; } } @@ -103,7 +109,11 @@ class UESUpdateHelper { try { return $adapter->getUserExtSource($extSourceName, $extLogin); - } catch (SimpleSAML\Module\perun\Exception $ex) { + } catch (PerunException $ex) { + Logger::debug( + self::DEBUG_PREFIX . 'Did not find extSource for combination of parameters extSourceName: \'' + . $extSourceName . '\', extLogin: \'' . $extLogin . '\'' + ); return null; } } @@ -217,7 +227,7 @@ class UESUpdateHelper strpos($attributeType, self::MAP_TYPE); } - public static function convertToString($newValue) + public static function convertToString($newValue): string { if (!empty($newValue)) { $newValue = array_unique($newValue);