@@ -230,13 +230,13 @@ discard block |
||
| 230 | 230 | return $values; |
| 231 | 231 | } else { |
| 232 | 232 | $low = $result['rangeHigh'] + 1; |
| 233 | - $attrToRead = $result['attributeName'] . ';range=' . $low . '-*'; |
|
| 233 | + $attrToRead = $result['attributeName'].';range='.$low.'-*'; |
|
| 234 | 234 | $isRangeRequest = true; |
| 235 | 235 | } |
| 236 | 236 | } |
| 237 | 237 | } while ($isRangeRequest); |
| 238 | 238 | |
| 239 | - $this->logger->debug('Requested attribute ' . $attr . ' not found for ' . $dn, ['app' => 'user_ldap']); |
|
| 239 | + $this->logger->debug('Requested attribute '.$attr.' not found for '.$dn, ['app' => 'user_ldap']); |
|
| 240 | 240 | return false; |
| 241 | 241 | } |
| 242 | 242 | |
@@ -254,13 +254,13 @@ discard block |
||
| 254 | 254 | if (!$this->ldap->isResource($rr)) { |
| 255 | 255 | if ($attribute !== '') { |
| 256 | 256 | //do not throw this message on userExists check, irritates |
| 257 | - $this->logger->debug('readAttribute failed for DN ' . $dn, ['app' => 'user_ldap']); |
|
| 257 | + $this->logger->debug('readAttribute failed for DN '.$dn, ['app' => 'user_ldap']); |
|
| 258 | 258 | } |
| 259 | 259 | //in case an error occurs , e.g. object does not exist |
| 260 | 260 | return false; |
| 261 | 261 | } |
| 262 | 262 | if ($attribute === '' && ($filter === 'objectclass=*' || $this->invokeLDAPMethod('countEntries', $rr) === 1)) { |
| 263 | - $this->logger->debug('readAttribute: ' . $dn . ' found', ['app' => 'user_ldap']); |
|
| 263 | + $this->logger->debug('readAttribute: '.$dn.' found', ['app' => 'user_ldap']); |
|
| 264 | 264 | return true; |
| 265 | 265 | } |
| 266 | 266 | $er = $this->invokeLDAPMethod('firstEntry', $rr); |
@@ -313,8 +313,8 @@ discard block |
||
| 313 | 313 | public function extractRangeData($result, $attribute) { |
| 314 | 314 | $keys = array_keys($result); |
| 315 | 315 | foreach ($keys as $key) { |
| 316 | - if ($key !== $attribute && strpos((string)$key, $attribute) === 0) { |
|
| 317 | - $queryData = explode(';', (string)$key); |
|
| 316 | + if ($key !== $attribute && strpos((string) $key, $attribute) === 0) { |
|
| 317 | + $queryData = explode(';', (string) $key); |
|
| 318 | 318 | if (strpos($queryData[1], 'range=') === 0) { |
| 319 | 319 | $high = substr($queryData[1], 1 + strpos($queryData[1], '-')); |
| 320 | 320 | $data = [ |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | * @throws \Exception |
| 341 | 341 | */ |
| 342 | 342 | public function setPassword($userDN, $password) { |
| 343 | - if ((int)$this->connection->turnOnPasswordChange !== 1) { |
|
| 343 | + if ((int) $this->connection->turnOnPasswordChange !== 1) { |
|
| 344 | 344 | throw new \Exception('LDAP password changes are disabled.'); |
| 345 | 345 | } |
| 346 | 346 | $cr = $this->connection->getConnectionResource(); |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | return @$this->invokeLDAPMethod('exopPasswd', $userDN, '', $password) || |
| 355 | 355 | @$this->invokeLDAPMethod('modReplace', $userDN, $password); |
| 356 | 356 | } catch (ConstraintViolationException $e) { |
| 357 | - throw new HintException('Password change rejected.', \OC::$server->getL10N('user_ldap')->t('Password change rejected. Hint: ') . $e->getMessage(), (int)$e->getCode()); |
|
| 357 | + throw new HintException('Password change rejected.', \OC::$server->getL10N('user_ldap')->t('Password change rejected. Hint: ').$e->getMessage(), (int) $e->getCode()); |
|
| 358 | 358 | } |
| 359 | 359 | } |
| 360 | 360 | |
@@ -494,7 +494,7 @@ discard block |
||
| 494 | 494 | */ |
| 495 | 495 | public function dn2ocname($fdn, $ldapName = null, $isUser = true, &$newlyMapped = null, array $record = null) { |
| 496 | 496 | static $intermediates = []; |
| 497 | - if (isset($intermediates[($isUser ? 'user-' : 'group-') . $fdn])) { |
|
| 497 | + if (isset($intermediates[($isUser ? 'user-' : 'group-').$fdn])) { |
|
| 498 | 498 | return false; // is a known intermediate |
| 499 | 499 | } |
| 500 | 500 | |
@@ -525,26 +525,26 @@ discard block |
||
| 525 | 525 | } |
| 526 | 526 | } else { |
| 527 | 527 | //If the UUID can't be detected something is foul. |
| 528 | - $this->logger->debug('Cannot determine UUID for ' . $fdn . '. Skipping.', ['app' => 'user_ldap']); |
|
| 528 | + $this->logger->debug('Cannot determine UUID for '.$fdn.'. Skipping.', ['app' => 'user_ldap']); |
|
| 529 | 529 | return false; |
| 530 | 530 | } |
| 531 | 531 | |
| 532 | 532 | if (is_null($ldapName)) { |
| 533 | 533 | $ldapName = $this->readAttribute($fdn, $nameAttribute, $filter); |
| 534 | 534 | if (!isset($ldapName[0]) || empty($ldapName[0])) { |
| 535 | - $this->logger->debug('No or empty name for ' . $fdn . ' with filter ' . $filter . '.', ['app' => 'user_ldap']); |
|
| 536 | - $intermediates[($isUser ? 'user-' : 'group-') . $fdn] = true; |
|
| 535 | + $this->logger->debug('No or empty name for '.$fdn.' with filter '.$filter.'.', ['app' => 'user_ldap']); |
|
| 536 | + $intermediates[($isUser ? 'user-' : 'group-').$fdn] = true; |
|
| 537 | 537 | return false; |
| 538 | 538 | } |
| 539 | 539 | $ldapName = $ldapName[0]; |
| 540 | 540 | } |
| 541 | 541 | |
| 542 | 542 | if ($isUser) { |
| 543 | - $usernameAttribute = (string)$this->connection->ldapExpertUsernameAttr; |
|
| 543 | + $usernameAttribute = (string) $this->connection->ldapExpertUsernameAttr; |
|
| 544 | 544 | if ($usernameAttribute !== '') { |
| 545 | 545 | $username = $this->readAttribute($fdn, $usernameAttribute); |
| 546 | 546 | if (!isset($username[0]) || empty($username[0])) { |
| 547 | - $this->logger->debug('No or empty username (' . $usernameAttribute . ') for ' . $fdn . '.', ['app' => 'user_ldap']); |
|
| 547 | + $this->logger->debug('No or empty username ('.$usernameAttribute.') for '.$fdn.'.', ['app' => 'user_ldap']); |
|
| 548 | 548 | return false; |
| 549 | 549 | } |
| 550 | 550 | $username = $username[0]; |
@@ -554,7 +554,7 @@ discard block |
||
| 554 | 554 | try { |
| 555 | 555 | $intName = $this->sanitizeUsername($username); |
| 556 | 556 | } catch (\InvalidArgumentException $e) { |
| 557 | - $this->logger->warning('Error sanitizing username: ' . $e->getMessage(), [ |
|
| 557 | + $this->logger->warning('Error sanitizing username: '.$e->getMessage(), [ |
|
| 558 | 558 | 'exception' => $e, |
| 559 | 559 | ]); |
| 560 | 560 | // we don't attempt to set a username here. We can go for |
@@ -604,7 +604,7 @@ discard block |
||
| 604 | 604 | } |
| 605 | 605 | |
| 606 | 606 | //if everything else did not help.. |
| 607 | - $this->logger->info('Could not create unique name for ' . $fdn . '.', ['app' => 'user_ldap']); |
|
| 607 | + $this->logger->info('Could not create unique name for '.$fdn.'.', ['app' => 'user_ldap']); |
|
| 608 | 608 | return false; |
| 609 | 609 | } |
| 610 | 610 | |
@@ -710,7 +710,7 @@ discard block |
||
| 710 | 710 | * @param string|false $home the home directory path |
| 711 | 711 | */ |
| 712 | 712 | public function cacheUserHome(string $ocName, $home): void { |
| 713 | - $cacheKey = 'getHome' . $ocName; |
|
| 713 | + $cacheKey = 'getHome'.$ocName; |
|
| 714 | 714 | $this->connection->writeToCache($cacheKey, $home); |
| 715 | 715 | } |
| 716 | 716 | |
@@ -718,14 +718,14 @@ discard block |
||
| 718 | 718 | * caches a user as existing |
| 719 | 719 | */ |
| 720 | 720 | public function cacheUserExists(string $ocName): void { |
| 721 | - $this->connection->writeToCache('userExists' . $ocName, true); |
|
| 721 | + $this->connection->writeToCache('userExists'.$ocName, true); |
|
| 722 | 722 | } |
| 723 | 723 | |
| 724 | 724 | /** |
| 725 | 725 | * caches a group as existing |
| 726 | 726 | */ |
| 727 | 727 | public function cacheGroupExists(string $gid): void { |
| 728 | - $this->connection->writeToCache('groupExists' . $gid, true); |
|
| 728 | + $this->connection->writeToCache('groupExists'.$gid, true); |
|
| 729 | 729 | } |
| 730 | 730 | |
| 731 | 731 | /** |
@@ -743,11 +743,11 @@ discard block |
||
| 743 | 743 | } |
| 744 | 744 | $displayName = $user->composeAndStoreDisplayName($displayName, $displayName2); |
| 745 | 745 | $cacheKeyTrunk = 'getDisplayName'; |
| 746 | - $this->connection->writeToCache($cacheKeyTrunk . $ocName, $displayName); |
|
| 746 | + $this->connection->writeToCache($cacheKeyTrunk.$ocName, $displayName); |
|
| 747 | 747 | } |
| 748 | 748 | |
| 749 | 749 | public function cacheGroupDisplayName(string $ncName, string $displayName): void { |
| 750 | - $cacheKey = 'group_getDisplayName' . $ncName; |
|
| 750 | + $cacheKey = 'group_getDisplayName'.$ncName; |
|
| 751 | 751 | $this->connection->writeToCache($cacheKey, $displayName); |
| 752 | 752 | } |
| 753 | 753 | |
@@ -765,7 +765,7 @@ discard block |
||
| 765 | 765 | //while loop is just a precaution. If a name is not generated within |
| 766 | 766 | //20 attempts, something else is very wrong. Avoids infinite loop. |
| 767 | 767 | while ($attempts < 20) { |
| 768 | - $altName = $name . '_' . rand(1000, 9999); |
|
| 768 | + $altName = $name.'_'.rand(1000, 9999); |
|
| 769 | 769 | if (!$this->ncUserManager->userExists($altName)) { |
| 770 | 770 | return $altName; |
| 771 | 771 | } |
@@ -794,9 +794,9 @@ discard block |
||
| 794 | 794 | } else { |
| 795 | 795 | natsort($usedNames); |
| 796 | 796 | $lastName = array_pop($usedNames); |
| 797 | - $lastNo = (int)substr($lastName, strrpos($lastName, '_') + 1); |
|
| 797 | + $lastNo = (int) substr($lastName, strrpos($lastName, '_') + 1); |
|
| 798 | 798 | } |
| 799 | - $altName = $name . '_' . (string)($lastNo + 1); |
|
| 799 | + $altName = $name.'_'.(string) ($lastNo + 1); |
|
| 800 | 800 | unset($usedNames); |
| 801 | 801 | |
| 802 | 802 | $attempts = 1; |
@@ -807,7 +807,7 @@ discard block |
||
| 807 | 807 | if (!\OC::$server->getGroupManager()->groupExists($altName)) { |
| 808 | 808 | return $altName; |
| 809 | 809 | } |
| 810 | - $altName = $name . '_' . ($lastNo + $attempts); |
|
| 810 | + $altName = $name.'_'.($lastNo + $attempts); |
|
| 811 | 811 | $attempts++; |
| 812 | 812 | } |
| 813 | 813 | return false; |
@@ -870,12 +870,12 @@ discard block |
||
| 870 | 870 | if (!$forceApplyAttributes) { |
| 871 | 871 | $isBackgroundJobModeAjax = $this->config |
| 872 | 872 | ->getAppValue('core', 'backgroundjobs_mode', 'ajax') === 'ajax'; |
| 873 | - $listOfDNs = array_reduce($ldapRecords, function ($listOfDNs, $entry) { |
|
| 873 | + $listOfDNs = array_reduce($ldapRecords, function($listOfDNs, $entry) { |
|
| 874 | 874 | $listOfDNs[] = $entry['dn'][0]; |
| 875 | 875 | return $listOfDNs; |
| 876 | 876 | }, []); |
| 877 | 877 | $idsByDn = $this->getUserMapper()->getListOfIdsByDn($listOfDNs); |
| 878 | - $recordsToUpdate = array_filter($ldapRecords, function ($record) use ($isBackgroundJobModeAjax, $idsByDn) { |
|
| 878 | + $recordsToUpdate = array_filter($ldapRecords, function($record) use ($isBackgroundJobModeAjax, $idsByDn) { |
|
| 879 | 879 | $newlyMapped = false; |
| 880 | 880 | $uid = $idsByDn[$record['dn'][0]] ?? null; |
| 881 | 881 | if ($uid === null) { |
@@ -899,7 +899,7 @@ discard block |
||
| 899 | 899 | * @throws \Exception |
| 900 | 900 | */ |
| 901 | 901 | public function batchApplyUserAttributes(array $ldapRecords): void { |
| 902 | - $displayNameAttribute = strtolower((string)$this->connection->ldapUserDisplayName); |
|
| 902 | + $displayNameAttribute = strtolower((string) $this->connection->ldapUserDisplayName); |
|
| 903 | 903 | foreach ($ldapRecords as $userRecord) { |
| 904 | 904 | if (!isset($userRecord[$displayNameAttribute])) { |
| 905 | 905 | // displayName is obligatory |
@@ -926,20 +926,20 @@ discard block |
||
| 926 | 926 | * @return array[] |
| 927 | 927 | */ |
| 928 | 928 | public function fetchListOfGroups(string $filter, array $attr, int $limit = null, int $offset = null): array { |
| 929 | - $cacheKey = 'fetchListOfGroups_' . $filter . '_' . implode('-', $attr) . '_' . (string)$limit . '_' . (string)$offset; |
|
| 929 | + $cacheKey = 'fetchListOfGroups_'.$filter.'_'.implode('-', $attr).'_'.(string) $limit.'_'.(string) $offset; |
|
| 930 | 930 | $listOfGroups = $this->connection->getFromCache($cacheKey); |
| 931 | 931 | if (!is_null($listOfGroups)) { |
| 932 | 932 | return $listOfGroups; |
| 933 | 933 | } |
| 934 | 934 | $groupRecords = $this->searchGroups($filter, $attr, $limit, $offset); |
| 935 | 935 | |
| 936 | - $listOfDNs = array_reduce($groupRecords, function ($listOfDNs, $entry) { |
|
| 936 | + $listOfDNs = array_reduce($groupRecords, function($listOfDNs, $entry) { |
|
| 937 | 937 | $listOfDNs[] = $entry['dn'][0]; |
| 938 | 938 | return $listOfDNs; |
| 939 | 939 | }, []); |
| 940 | 940 | $idsByDn = $this->getGroupMapper()->getListOfIdsByDn($listOfDNs); |
| 941 | 941 | |
| 942 | - array_walk($groupRecords, function (array $record) use ($idsByDn) { |
|
| 942 | + array_walk($groupRecords, function(array $record) use ($idsByDn) { |
|
| 943 | 943 | $newlyMapped = false; |
| 944 | 944 | $gid = $idsByDn[$record['dn'][0]] ?? null; |
| 945 | 945 | if ($gid === null) { |
@@ -958,7 +958,7 @@ discard block |
||
| 958 | 958 | if ($manyAttributes) { |
| 959 | 959 | return $list; |
| 960 | 960 | } else { |
| 961 | - $list = array_reduce($list, function ($carry, $item) { |
|
| 961 | + $list = array_reduce($list, function($carry, $item) { |
|
| 962 | 962 | $attribute = array_keys($item)[0]; |
| 963 | 963 | $carry[] = $item[$attribute][0]; |
| 964 | 964 | return $carry; |
@@ -987,7 +987,7 @@ discard block |
||
| 987 | 987 | $result = false; |
| 988 | 988 | foreach ($this->connection->ldapBaseUsers as $base) { |
| 989 | 989 | $count = $this->count($filter, [$base], $attr, $limit ?? 0, $offset ?? 0); |
| 990 | - $result = is_int($count) ? (int)$result + $count : $result; |
|
| 990 | + $result = is_int($count) ? (int) $result + $count : $result; |
|
| 991 | 991 | } |
| 992 | 992 | return $result; |
| 993 | 993 | } |
@@ -1018,7 +1018,7 @@ discard block |
||
| 1018 | 1018 | $result = false; |
| 1019 | 1019 | foreach ($this->connection->ldapBaseGroups as $base) { |
| 1020 | 1020 | $count = $this->count($filter, [$base], $attr, $limit ?? 0, $offset ?? 0); |
| 1021 | - $result = is_int($count) ? (int)$result + $count : $result; |
|
| 1021 | + $result = is_int($count) ? (int) $result + $count : $result; |
|
| 1022 | 1022 | } |
| 1023 | 1023 | return $result; |
| 1024 | 1024 | } |
@@ -1033,7 +1033,7 @@ discard block |
||
| 1033 | 1033 | $result = false; |
| 1034 | 1034 | foreach ($this->connection->ldapBase as $base) { |
| 1035 | 1035 | $count = $this->count('objectclass=*', [$base], ['dn'], $limit ?? 0, $offset ?? 0); |
| 1036 | - $result = is_int($count) ? (int)$result + $count : $result; |
|
| 1036 | + $result = is_int($count) ? (int) $result + $count : $result; |
|
| 1037 | 1037 | } |
| 1038 | 1038 | return $result; |
| 1039 | 1039 | } |
@@ -1060,7 +1060,7 @@ discard block |
||
| 1060 | 1060 | return null; |
| 1061 | 1061 | } |
| 1062 | 1062 | array_unshift($arguments, $this->connection->getConnectionResource()); |
| 1063 | - $doMethod = function () use ($command, &$arguments) { |
|
| 1063 | + $doMethod = function() use ($command, &$arguments) { |
|
| 1064 | 1064 | return call_user_func_array([$this->ldap, $command], $arguments); |
| 1065 | 1065 | }; |
| 1066 | 1066 | try { |
@@ -1116,7 +1116,7 @@ discard block |
||
| 1116 | 1116 | |
| 1117 | 1117 | //check whether paged search should be attempted |
| 1118 | 1118 | try { |
| 1119 | - [$pagedSearchOK, $pageSize, $cookie] = $this->initPagedSearch($filter, $base, $attr, (int)$pageSize, (int)$offset); |
|
| 1119 | + [$pagedSearchOK, $pageSize, $cookie] = $this->initPagedSearch($filter, $base, $attr, (int) $pageSize, (int) $offset); |
|
| 1120 | 1120 | } catch (NoMoreResults $e) { |
| 1121 | 1121 | // beyond last results page |
| 1122 | 1122 | return false; |
@@ -1125,7 +1125,7 @@ discard block |
||
| 1125 | 1125 | $sr = $this->invokeLDAPMethod('search', $base, $filter, $attr, 0, 0, $pageSize, $cookie); |
| 1126 | 1126 | $error = $this->ldap->errno($this->connection->getConnectionResource()); |
| 1127 | 1127 | if (!$this->ldap->isResource($sr) || $error !== 0) { |
| 1128 | - $this->logger->error('Attempt for Paging? ' . print_r($pagedSearchOK, true), ['app' => 'user_ldap']); |
|
| 1128 | + $this->logger->error('Attempt for Paging? '.print_r($pagedSearchOK, true), ['app' => 'user_ldap']); |
|
| 1129 | 1129 | return false; |
| 1130 | 1130 | } |
| 1131 | 1131 | |
@@ -1169,7 +1169,7 @@ discard block |
||
| 1169 | 1169 | $this->pagedSearchedSuccessful = true; |
| 1170 | 1170 | } |
| 1171 | 1171 | } else { |
| 1172 | - if ((int)$this->connection->ldapPagingSize !== 0) { |
|
| 1172 | + if ((int) $this->connection->ldapPagingSize !== 0) { |
|
| 1173 | 1173 | $this->logger->debug( |
| 1174 | 1174 | 'Paged search was not available', |
| 1175 | 1175 | ['app' => 'user_ldap'] |
@@ -1211,7 +1211,7 @@ discard block |
||
| 1211 | 1211 | 'filter' => $filter |
| 1212 | 1212 | ]); |
| 1213 | 1213 | |
| 1214 | - $limitPerPage = (int)$this->connection->ldapPagingSize; |
|
| 1214 | + $limitPerPage = (int) $this->connection->ldapPagingSize; |
|
| 1215 | 1215 | if ($limit < $limitPerPage && $limit > 0) { |
| 1216 | 1216 | $limitPerPage = $limit; |
| 1217 | 1217 | } |
@@ -1253,7 +1253,7 @@ discard block |
||
| 1253 | 1253 | * @throws ServerNotAvailableException |
| 1254 | 1254 | */ |
| 1255 | 1255 | private function countEntriesInSearchResults($sr): int { |
| 1256 | - return (int)$this->invokeLDAPMethod('countEntries', $sr); |
|
| 1256 | + return (int) $this->invokeLDAPMethod('countEntries', $sr); |
|
| 1257 | 1257 | } |
| 1258 | 1258 | |
| 1259 | 1259 | /** |
@@ -1269,7 +1269,7 @@ discard block |
||
| 1269 | 1269 | ?int $offset = null, |
| 1270 | 1270 | bool $skipHandling = false |
| 1271 | 1271 | ): array { |
| 1272 | - $limitPerPage = (int)$this->connection->ldapPagingSize; |
|
| 1272 | + $limitPerPage = (int) $this->connection->ldapPagingSize; |
|
| 1273 | 1273 | if (!is_null($limit) && $limit < $limitPerPage && $limit > 0) { |
| 1274 | 1274 | $limitPerPage = $limit; |
| 1275 | 1275 | } |
@@ -1422,7 +1422,7 @@ discard block |
||
| 1422 | 1422 | } |
| 1423 | 1423 | $search = ['*', '\\', '(', ')']; |
| 1424 | 1424 | $replace = ['\\*', '\\\\', '\\(', '\\)']; |
| 1425 | - return $asterisk . str_replace($search, $replace, $input); |
|
| 1425 | + return $asterisk.str_replace($search, $replace, $input); |
|
| 1426 | 1426 | } |
| 1427 | 1427 | |
| 1428 | 1428 | /** |
@@ -1454,10 +1454,10 @@ discard block |
||
| 1454 | 1454 | * @return string the combined filter |
| 1455 | 1455 | */ |
| 1456 | 1456 | private function combineFilter(array $filters, string $operator): string { |
| 1457 | - $combinedFilter = '(' . $operator; |
|
| 1457 | + $combinedFilter = '('.$operator; |
|
| 1458 | 1458 | foreach ($filters as $filter) { |
| 1459 | 1459 | if ($filter !== '' && $filter[0] !== '(') { |
| 1460 | - $filter = '(' . $filter . ')'; |
|
| 1460 | + $filter = '('.$filter.')'; |
|
| 1461 | 1461 | } |
| 1462 | 1462 | $combinedFilter .= $filter; |
| 1463 | 1463 | } |
@@ -1510,7 +1510,7 @@ discard block |
||
| 1510 | 1510 | //every word needs to appear at least once |
| 1511 | 1511 | $wordMatchOneAttrFilters = []; |
| 1512 | 1512 | foreach ($searchAttributes as $attr) { |
| 1513 | - $wordMatchOneAttrFilters[] = $attr . '=' . $word; |
|
| 1513 | + $wordMatchOneAttrFilters[] = $attr.'='.$word; |
|
| 1514 | 1514 | } |
| 1515 | 1515 | $wordFilters[] = $this->combineFilterWithOr($wordMatchOneAttrFilters); |
| 1516 | 1516 | } |
@@ -1544,17 +1544,17 @@ discard block |
||
| 1544 | 1544 | return ''; |
| 1545 | 1545 | } |
| 1546 | 1546 | // wildcards don't work with some attributes |
| 1547 | - $filter[] = $fallbackAttribute . '=' . $originalSearch; |
|
| 1548 | - $filter[] = $fallbackAttribute . '=' . $search; |
|
| 1547 | + $filter[] = $fallbackAttribute.'='.$originalSearch; |
|
| 1548 | + $filter[] = $fallbackAttribute.'='.$search; |
|
| 1549 | 1549 | } else { |
| 1550 | 1550 | foreach ($searchAttributes as $attribute) { |
| 1551 | 1551 | // wildcards don't work with some attributes |
| 1552 | - $filter[] = $attribute . '=' . $originalSearch; |
|
| 1553 | - $filter[] = $attribute . '=' . $search; |
|
| 1552 | + $filter[] = $attribute.'='.$originalSearch; |
|
| 1553 | + $filter[] = $attribute.'='.$search; |
|
| 1554 | 1554 | } |
| 1555 | 1555 | } |
| 1556 | 1556 | if (count($filter) === 1) { |
| 1557 | - return '(' . $filter[0] . ')'; |
|
| 1557 | + return '('.$filter[0].')'; |
|
| 1558 | 1558 | } |
| 1559 | 1559 | return $this->combineFilterWithOr($filter); |
| 1560 | 1560 | } |
@@ -1573,7 +1573,7 @@ discard block |
||
| 1573 | 1573 | if ($term === '') { |
| 1574 | 1574 | $result = '*'; |
| 1575 | 1575 | } elseif ($allowEnum !== 'no') { |
| 1576 | - $result = $term . '*'; |
|
| 1576 | + $result = $term.'*'; |
|
| 1577 | 1577 | } |
| 1578 | 1578 | return $result; |
| 1579 | 1579 | } |
@@ -1584,7 +1584,7 @@ discard block |
||
| 1584 | 1584 | public function getFilterForUserCount(): string { |
| 1585 | 1585 | $filter = $this->combineFilterWithAnd([ |
| 1586 | 1586 | $this->connection->ldapUserFilter, |
| 1587 | - $this->connection->ldapUserDisplayName . '=*' |
|
| 1587 | + $this->connection->ldapUserDisplayName.'=*' |
|
| 1588 | 1588 | ]); |
| 1589 | 1589 | |
| 1590 | 1590 | return $filter; |
@@ -1650,7 +1650,7 @@ discard block |
||
| 1650 | 1650 | $uuid = $this->formatGuid2ForFilterUser($uuid); |
| 1651 | 1651 | } |
| 1652 | 1652 | |
| 1653 | - $filter = $uuidAttr . '=' . $uuid; |
|
| 1653 | + $filter = $uuidAttr.'='.$uuid; |
|
| 1654 | 1654 | $result = $this->searchUsers($filter, ['dn'], 2); |
| 1655 | 1655 | if (isset($result[0]['dn']) && count($result) === 1) { |
| 1656 | 1656 | // we put the count into account to make sure that this is |
@@ -1777,8 +1777,8 @@ discard block |
||
| 1777 | 1777 | for ($k = 1; $k <= 2; ++$k) { |
| 1778 | 1778 | $hex_guid_to_guid_str .= substr($hex_guid, 16 - 2 * $k, 2); |
| 1779 | 1779 | } |
| 1780 | - $hex_guid_to_guid_str .= '-' . substr($hex_guid, 16, 4); |
|
| 1781 | - $hex_guid_to_guid_str .= '-' . substr($hex_guid, 20); |
|
| 1780 | + $hex_guid_to_guid_str .= '-'.substr($hex_guid, 16, 4); |
|
| 1781 | + $hex_guid_to_guid_str .= '-'.substr($hex_guid, 20); |
|
| 1782 | 1782 | |
| 1783 | 1783 | return strtoupper($hex_guid_to_guid_str); |
| 1784 | 1784 | } |
@@ -1806,7 +1806,7 @@ discard block |
||
| 1806 | 1806 | * user. Instead we write a log message. |
| 1807 | 1807 | */ |
| 1808 | 1808 | $this->logger->info( |
| 1809 | - 'Passed string does not resemble a valid GUID. Known UUID ' . |
|
| 1809 | + 'Passed string does not resemble a valid GUID. Known UUID '. |
|
| 1810 | 1810 | '({uuid}) probably does not match UUID configuration.', |
| 1811 | 1811 | ['app' => 'user_ldap', 'uuid' => $guid] |
| 1812 | 1812 | ); |
@@ -1819,7 +1819,7 @@ discard block |
||
| 1819 | 1819 | } |
| 1820 | 1820 | for ($i = 0; $i < 5; $i++) { |
| 1821 | 1821 | $pairs = str_split($blocks[$i], 2); |
| 1822 | - $blocks[$i] = '\\' . implode('\\', $pairs); |
|
| 1822 | + $blocks[$i] = '\\'.implode('\\', $pairs); |
|
| 1823 | 1823 | } |
| 1824 | 1824 | return implode('', $blocks); |
| 1825 | 1825 | } |
@@ -1833,7 +1833,7 @@ discard block |
||
| 1833 | 1833 | */ |
| 1834 | 1834 | public function getSID($dn) { |
| 1835 | 1835 | $domainDN = $this->getDomainDNFromDN($dn); |
| 1836 | - $cacheKey = 'getSID-' . $domainDN; |
|
| 1836 | + $cacheKey = 'getSID-'.$domainDN; |
|
| 1837 | 1837 | $sid = $this->connection->getFromCache($cacheKey); |
| 1838 | 1838 | if (!is_null($sid)) { |
| 1839 | 1839 | return $sid; |
@@ -2019,7 +2019,7 @@ discard block |
||
| 2019 | 2019 | $this->abandonPagedSearch(); |
| 2020 | 2020 | // in case someone set it to 0 … use 500, otherwise no results will |
| 2021 | 2021 | // be returned. |
| 2022 | - $pageSize = (int)$this->connection->ldapPagingSize > 0 ? (int)$this->connection->ldapPagingSize : 500; |
|
| 2022 | + $pageSize = (int) $this->connection->ldapPagingSize > 0 ? (int) $this->connection->ldapPagingSize : 500; |
|
| 2023 | 2023 | return [true, $pageSize, $this->lastCookie]; |
| 2024 | 2024 | } |
| 2025 | 2025 | |