@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | * @return string|false |
198 | 198 | */ |
199 | 199 | public function loginName2UserName($loginName) { |
200 | - $id = 'LOGINNAME,' . $loginName; |
|
200 | + $id = 'LOGINNAME,'.$loginName; |
|
201 | 201 | return $this->handleRequest($id, 'loginName2UserName', [$loginName]); |
202 | 202 | } |
203 | 203 | |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | * @return string|false with the username |
209 | 209 | */ |
210 | 210 | public function dn2UserName($dn) { |
211 | - $id = 'DN,' . $dn; |
|
211 | + $id = 'DN,'.$dn; |
|
212 | 212 | return $this->handleRequest($id, 'dn2UserName', [$dn]); |
213 | 213 | } |
214 | 214 |
@@ -96,10 +96,10 @@ discard block |
||
96 | 96 | if (!$this->enabled) { |
97 | 97 | return false; |
98 | 98 | } |
99 | - $cacheKey = 'inGroup' . $uid . ':' . $gid; |
|
99 | + $cacheKey = 'inGroup'.$uid.':'.$gid; |
|
100 | 100 | $inGroup = $this->access->connection->getFromCache($cacheKey); |
101 | 101 | if (!is_null($inGroup)) { |
102 | - return (bool)$inGroup; |
|
102 | + return (bool) $inGroup; |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | $userDN = $this->access->username2dn($uid); |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | return $isInGroup; |
110 | 110 | } |
111 | 111 | |
112 | - $cacheKeyMembers = 'inGroup-members:' . $gid; |
|
112 | + $cacheKeyMembers = 'inGroup-members:'.$gid; |
|
113 | 113 | $members = $this->access->connection->getFromCache($cacheKeyMembers); |
114 | 114 | if (!is_null($members)) { |
115 | 115 | $this->cachedGroupMembers[$gid] = $members; |
@@ -206,8 +206,8 @@ discard block |
||
206 | 206 | $dynamicMembers[$value['dn'][0]] = 1; |
207 | 207 | } |
208 | 208 | } else { |
209 | - \OCP\Util::writeLog('user_ldap', 'No search filter found on member url ' . |
|
210 | - 'of group ' . $dnGroup, ILogger::DEBUG); |
|
209 | + \OCP\Util::writeLog('user_ldap', 'No search filter found on member url '. |
|
210 | + 'of group '.$dnGroup, ILogger::DEBUG); |
|
211 | 211 | } |
212 | 212 | } |
213 | 213 | return $dynamicMembers; |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | return []; |
230 | 230 | } |
231 | 231 | // used extensively in cron job, caching makes sense for nested groups |
232 | - $cacheKey = '_groupMembers' . $dnGroup; |
|
232 | + $cacheKey = '_groupMembers'.$dnGroup; |
|
233 | 233 | $groupMembers = $this->access->connection->getFromCache($cacheKey); |
234 | 234 | if ($groupMembers !== null) { |
235 | 235 | return $groupMembers; |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | $seen[$dnGroup] = 1; |
238 | 238 | $members = $this->access->readAttribute($dnGroup, $this->access->connection->ldapGroupMemberAssocAttr); |
239 | 239 | if (is_array($members)) { |
240 | - $fetcher = function ($memberDN, &$seen) { |
|
240 | + $fetcher = function($memberDN, &$seen) { |
|
241 | 241 | return $this->_groupMembers($memberDN, $seen); |
242 | 242 | }; |
243 | 243 | $allMembers = $this->walkNestedGroups($dnGroup, $fetcher, $members); |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | return []; |
262 | 262 | } |
263 | 263 | |
264 | - $fetcher = function ($groupDN) { |
|
264 | + $fetcher = function($groupDN) { |
|
265 | 265 | if (isset($this->cachedNestedGroups[$groupDN])) { |
266 | 266 | $nestedGroups = $this->cachedNestedGroups[$groupDN]; |
267 | 267 | } else { |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | * @return array |
286 | 286 | */ |
287 | 287 | private function walkNestedGroups(string $dn, \Closure $fetcher, array $list): array { |
288 | - $nesting = (int)$this->access->connection->ldapNestedGroups; |
|
288 | + $nesting = (int) $this->access->connection->ldapNestedGroups; |
|
289 | 289 | // depending on the input, we either have a list of DNs or a list of LDAP records |
290 | 290 | // also, the output expects either DNs or records. Testing the first element should suffice. |
291 | 291 | $recordMode = is_array($list) && isset($list[0]) && is_array($list[0]) && isset($list[0]['dn'][0]); |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | if ($nesting !== 1) { |
294 | 294 | if ($recordMode) { |
295 | 295 | // the keys are numeric, but should hold the DN |
296 | - return array_reduce($list, function ($transformed, $record) use ($dn) { |
|
296 | + return array_reduce($list, function($transformed, $record) use ($dn) { |
|
297 | 297 | if ($record['dn'][0] != $dn) { |
298 | 298 | $transformed[$record['dn'][0]] = $record; |
299 | 299 | } |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | * @return string|bool |
327 | 327 | */ |
328 | 328 | public function gidNumber2Name($gid, $dn) { |
329 | - $cacheKey = 'gidNumberToName' . $gid; |
|
329 | + $cacheKey = 'gidNumberToName'.$gid; |
|
330 | 330 | $groupName = $this->access->connection->getFromCache($cacheKey); |
331 | 331 | if (!is_null($groupName) && isset($groupName)) { |
332 | 332 | return $groupName; |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | $filter = $this->access->combineFilterWithAnd([ |
337 | 337 | $this->access->connection->ldapGroupFilter, |
338 | 338 | 'objectClass=posixGroup', |
339 | - $this->access->connection->ldapGidNumber . '=' . $gid |
|
339 | + $this->access->connection->ldapGidNumber.'='.$gid |
|
340 | 340 | ]); |
341 | 341 | $result = $this->access->searchGroups($filter, ['dn'], 1); |
342 | 342 | if (empty($result)) { |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | if ($search !== '') { |
416 | 416 | $filterParts[] = $this->access->getFilterPartForUserSearch($search); |
417 | 417 | } |
418 | - $filterParts[] = $this->access->connection->ldapGidNumber . '=' . $groupID; |
|
418 | + $filterParts[] = $this->access->connection->ldapGidNumber.'='.$groupID; |
|
419 | 419 | |
420 | 420 | return $this->access->combineFilterWithAnd($filterParts); |
421 | 421 | } |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | try { |
458 | 458 | $filter = $this->prepareFilterForUsersHasGidNumber($groupDN, $search); |
459 | 459 | $users = $this->access->countUsers($filter, ['dn'], $limit, $offset); |
460 | - return (int)$users; |
|
460 | + return (int) $users; |
|
461 | 461 | } catch (\Exception $e) { |
462 | 462 | return 0; |
463 | 463 | } |
@@ -503,7 +503,7 @@ discard block |
||
503 | 503 | //we need to get the DN from LDAP |
504 | 504 | $filter = $this->access->combineFilterWithAnd([ |
505 | 505 | $this->access->connection->ldapGroupFilter, |
506 | - 'objectsid=' . $domainObjectSid . '-' . $gid |
|
506 | + 'objectsid='.$domainObjectSid.'-'.$gid |
|
507 | 507 | ]); |
508 | 508 | $result = $this->access->searchGroups($filter, ['dn'], 1); |
509 | 509 | if (empty($result)) { |
@@ -582,7 +582,7 @@ discard block |
||
582 | 582 | if ($search !== '') { |
583 | 583 | $filterParts[] = $this->access->getFilterPartForUserSearch($search); |
584 | 584 | } |
585 | - $filterParts[] = 'primaryGroupID=' . $groupID; |
|
585 | + $filterParts[] = 'primaryGroupID='.$groupID; |
|
586 | 586 | |
587 | 587 | return $this->access->combineFilterWithAnd($filterParts); |
588 | 588 | } |
@@ -624,7 +624,7 @@ discard block |
||
624 | 624 | try { |
625 | 625 | $filter = $this->prepareFilterForUsersInPrimaryGroup($groupDN, $search); |
626 | 626 | $users = $this->access->countUsers($filter, ['dn'], $limit, $offset); |
627 | - return (int)$users; |
|
627 | + return (int) $users; |
|
628 | 628 | } catch (\Exception $e) { |
629 | 629 | return 0; |
630 | 630 | } |
@@ -663,7 +663,7 @@ discard block |
||
663 | 663 | if (!$this->enabled) { |
664 | 664 | return []; |
665 | 665 | } |
666 | - $cacheKey = 'getUserGroups' . $uid; |
|
666 | + $cacheKey = 'getUserGroups'.$uid; |
|
667 | 667 | $userGroups = $this->access->connection->getFromCache($cacheKey); |
668 | 668 | if (!is_null($userGroups)) { |
669 | 669 | return $userGroups; |
@@ -708,8 +708,8 @@ discard block |
||
708 | 708 | } |
709 | 709 | } |
710 | 710 | } else { |
711 | - \OCP\Util::writeLog('user_ldap', 'No search filter found on member url ' . |
|
712 | - 'of group ' . print_r($dynamicGroup, true), ILogger::DEBUG); |
|
711 | + \OCP\Util::writeLog('user_ldap', 'No search filter found on member url '. |
|
712 | + 'of group '.print_r($dynamicGroup, true), ILogger::DEBUG); |
|
713 | 713 | } |
714 | 714 | } |
715 | 715 | } |
@@ -717,8 +717,8 @@ discard block |
||
717 | 717 | // if possible, read out membership via memberOf. It's far faster than |
718 | 718 | // performing a search, which still is a fallback later. |
719 | 719 | // memberof doesn't support memberuid, so skip it here. |
720 | - if ((int)$this->access->connection->hasMemberOfFilterSupport === 1 |
|
721 | - && (int)$this->access->connection->useMemberOfToDetectMembership === 1 |
|
720 | + if ((int) $this->access->connection->hasMemberOfFilterSupport === 1 |
|
721 | + && (int) $this->access->connection->useMemberOfToDetectMembership === 1 |
|
722 | 722 | && strtolower($this->access->connection->ldapGroupMemberAssocAttr) !== 'memberuid' |
723 | 723 | ) { |
724 | 724 | $groupDNs = $this->_getGroupDNsFromMemberOf($userDN); |
@@ -751,7 +751,7 @@ discard block |
||
751 | 751 | } elseif (strtolower($this->access->connection->ldapGroupMemberAssocAttr) === 'memberuid') { |
752 | 752 | $result = $this->access->readAttribute($userDN, 'uid'); |
753 | 753 | if ($result === false) { |
754 | - \OCP\Util::writeLog('user_ldap', 'No uid attribute found for DN ' . $userDN . ' on ' . |
|
754 | + \OCP\Util::writeLog('user_ldap', 'No uid attribute found for DN '.$userDN.' on '. |
|
755 | 755 | $this->access->connection->ldapHost, ILogger::DEBUG); |
756 | 756 | $uid = false; |
757 | 757 | } else { |
@@ -801,11 +801,11 @@ discard block |
||
801 | 801 | } |
802 | 802 | $allGroups = []; |
803 | 803 | $seen[$dn] = true; |
804 | - $filter = $this->access->connection->ldapGroupMemberAssocAttr . '=' . $dn; |
|
804 | + $filter = $this->access->connection->ldapGroupMemberAssocAttr.'='.$dn; |
|
805 | 805 | $groups = $this->access->fetchListOfGroups($filter, |
806 | 806 | [strtolower($this->access->connection->ldapGroupMemberAssocAttr), $this->access->connection->ldapGroupDisplayName, 'dn']); |
807 | 807 | if (is_array($groups)) { |
808 | - $fetcher = function ($dn, &$seen) { |
|
808 | + $fetcher = function($dn, &$seen) { |
|
809 | 809 | if (is_array($dn) && isset($dn['dn'][0])) { |
810 | 810 | $dn = $dn['dn'][0]; |
811 | 811 | } |
@@ -835,7 +835,7 @@ discard block |
||
835 | 835 | return []; |
836 | 836 | } |
837 | 837 | $search = $this->access->escapeFilterPart($search, true); |
838 | - $cacheKey = 'usersInGroup-' . $gid . '-' . $search . '-' . $limit . '-' . $offset; |
|
838 | + $cacheKey = 'usersInGroup-'.$gid.'-'.$search.'-'.$limit.'-'.$offset; |
|
839 | 839 | // check for cache of the exact query |
840 | 840 | $groupUsers = $this->access->connection->getFromCache($cacheKey); |
841 | 841 | if (!is_null($groupUsers)) { |
@@ -843,7 +843,7 @@ discard block |
||
843 | 843 | } |
844 | 844 | |
845 | 845 | // check for cache of the query without limit and offset |
846 | - $groupUsers = $this->access->connection->getFromCache('usersInGroup-' . $gid . '-' . $search); |
|
846 | + $groupUsers = $this->access->connection->getFromCache('usersInGroup-'.$gid.'-'.$search); |
|
847 | 847 | if (!is_null($groupUsers)) { |
848 | 848 | $groupUsers = array_slice($groupUsers, $offset, $limit); |
849 | 849 | $this->access->connection->writeToCache($cacheKey, $groupUsers); |
@@ -894,7 +894,7 @@ discard block |
||
894 | 894 | continue; |
895 | 895 | } |
896 | 896 | |
897 | - $cacheKey = 'userExistsOnLDAP' . $uid; |
|
897 | + $cacheKey = 'userExistsOnLDAP'.$uid; |
|
898 | 898 | $userExists = $this->access->connection->getFromCache($cacheKey); |
899 | 899 | if ($userExists === false) { |
900 | 900 | continue; |
@@ -919,7 +919,7 @@ discard block |
||
919 | 919 | |
920 | 920 | $groupUsers = array_unique(array_merge($groupUsers, $primaryUsers, $posixGroupUsers)); |
921 | 921 | natsort($groupUsers); |
922 | - $this->access->connection->writeToCache('usersInGroup-' . $gid . '-' . $search, $groupUsers); |
|
922 | + $this->access->connection->writeToCache('usersInGroup-'.$gid.'-'.$search, $groupUsers); |
|
923 | 923 | $groupUsers = array_slice($groupUsers, $offset, $limit); |
924 | 924 | |
925 | 925 | $this->access->connection->writeToCache($cacheKey, $groupUsers); |
@@ -939,7 +939,7 @@ discard block |
||
939 | 939 | return $this->groupPluginManager->countUsersInGroup($gid, $search); |
940 | 940 | } |
941 | 941 | |
942 | - $cacheKey = 'countUsersInGroup-' . $gid . '-' . $search; |
|
942 | + $cacheKey = 'countUsersInGroup-'.$gid.'-'.$search; |
|
943 | 943 | if (!$this->enabled || !$this->groupExists($gid)) { |
944 | 944 | return false; |
945 | 945 | } |
@@ -1028,10 +1028,10 @@ discard block |
||
1028 | 1028 | if (!$this->enabled) { |
1029 | 1029 | return []; |
1030 | 1030 | } |
1031 | - $cacheKey = 'getGroups-' . $search . '-' . $limit . '-' . $offset; |
|
1031 | + $cacheKey = 'getGroups-'.$search.'-'.$limit.'-'.$offset; |
|
1032 | 1032 | |
1033 | 1033 | //Check cache before driving unnecessary searches |
1034 | - \OCP\Util::writeLog('user_ldap', 'getGroups ' . $cacheKey, ILogger::DEBUG); |
|
1034 | + \OCP\Util::writeLog('user_ldap', 'getGroups '.$cacheKey, ILogger::DEBUG); |
|
1035 | 1035 | $ldap_groups = $this->access->connection->getFromCache($cacheKey); |
1036 | 1036 | if (!is_null($ldap_groups)) { |
1037 | 1037 | return $ldap_groups; |
@@ -1046,7 +1046,7 @@ discard block |
||
1046 | 1046 | $this->access->connection->ldapGroupFilter, |
1047 | 1047 | $this->access->getFilterPartForGroupSearch($search) |
1048 | 1048 | ]); |
1049 | - \OCP\Util::writeLog('user_ldap', 'getGroups Filter ' . $filter, ILogger::DEBUG); |
|
1049 | + \OCP\Util::writeLog('user_ldap', 'getGroups Filter '.$filter, ILogger::DEBUG); |
|
1050 | 1050 | $ldap_groups = $this->access->fetchListOfGroups($filter, |
1051 | 1051 | [$this->access->connection->ldapGroupDisplayName, 'dn'], |
1052 | 1052 | $limit, |
@@ -1075,7 +1075,7 @@ discard block |
||
1075 | 1075 | return []; |
1076 | 1076 | } |
1077 | 1077 | $search = $this->access->escapeFilterPart($search, true); |
1078 | - $pagingSize = (int)$this->access->connection->ldapPagingSize; |
|
1078 | + $pagingSize = (int) $this->access->connection->ldapPagingSize; |
|
1079 | 1079 | if ($pagingSize <= 0) { |
1080 | 1080 | return $this->getGroupsChunk($search, $limit, $offset); |
1081 | 1081 | } |
@@ -1091,7 +1091,7 @@ discard block |
||
1091 | 1091 | $chunkLimit = min($pagingSize, $overallLimit - $chunkOffset); |
1092 | 1092 | $ldapGroups = $this->getGroupsChunk($search, $chunkLimit, $chunkOffset); |
1093 | 1093 | $nread = count($ldapGroups); |
1094 | - \OCP\Util::writeLog('user_ldap', 'getGroups(' . $search . '): read ' . $nread . ' at offset ' . $chunkOffset . ' (limit: ' . $chunkLimit . ')', ILogger::DEBUG); |
|
1094 | + \OCP\Util::writeLog('user_ldap', 'getGroups('.$search.'): read '.$nread.' at offset '.$chunkOffset.' (limit: '.$chunkLimit.')', ILogger::DEBUG); |
|
1095 | 1095 | if ($nread) { |
1096 | 1096 | $allGroups = array_merge($allGroups, $ldapGroups); |
1097 | 1097 | $chunkOffset += $nread; |
@@ -1118,31 +1118,31 @@ discard block |
||
1118 | 1118 | * @return bool |
1119 | 1119 | */ |
1120 | 1120 | public function groupExists($gid) { |
1121 | - $groupExists = $this->access->connection->getFromCache('groupExists' . $gid); |
|
1121 | + $groupExists = $this->access->connection->getFromCache('groupExists'.$gid); |
|
1122 | 1122 | if (!is_null($groupExists)) { |
1123 | - return (bool)$groupExists; |
|
1123 | + return (bool) $groupExists; |
|
1124 | 1124 | } |
1125 | 1125 | |
1126 | 1126 | //getting dn, if false the group does not exist. If dn, it may be mapped |
1127 | 1127 | //only, requires more checking. |
1128 | 1128 | $dn = $this->access->groupname2dn($gid); |
1129 | 1129 | if (!$dn) { |
1130 | - $this->access->connection->writeToCache('groupExists' . $gid, false); |
|
1130 | + $this->access->connection->writeToCache('groupExists'.$gid, false); |
|
1131 | 1131 | return false; |
1132 | 1132 | } |
1133 | 1133 | |
1134 | 1134 | if (!$this->access->isDNPartOfBase($dn, $this->access->connection->ldapBaseGroups)) { |
1135 | - $this->access->connection->writeToCache('groupExists' . $gid, false); |
|
1135 | + $this->access->connection->writeToCache('groupExists'.$gid, false); |
|
1136 | 1136 | return false; |
1137 | 1137 | } |
1138 | 1138 | |
1139 | 1139 | //if group really still exists, we will be able to read its objectclass |
1140 | 1140 | if (!is_array($this->access->readAttribute($dn, '', $this->access->connection->ldapGroupFilter))) { |
1141 | - $this->access->connection->writeToCache('groupExists' . $gid, false); |
|
1141 | + $this->access->connection->writeToCache('groupExists'.$gid, false); |
|
1142 | 1142 | return false; |
1143 | 1143 | } |
1144 | 1144 | |
1145 | - $this->access->connection->writeToCache('groupExists' . $gid, true); |
|
1145 | + $this->access->connection->writeToCache('groupExists'.$gid, true); |
|
1146 | 1146 | return true; |
1147 | 1147 | } |
1148 | 1148 | |
@@ -1171,7 +1171,7 @@ discard block |
||
1171 | 1171 | * compared with GroupInterface::CREATE_GROUP etc. |
1172 | 1172 | */ |
1173 | 1173 | public function implementsActions($actions) { |
1174 | - return (bool)((GroupInterface::COUNT_USERS | |
|
1174 | + return (bool) ((GroupInterface::COUNT_USERS | |
|
1175 | 1175 | $this->groupPluginManager->getImplementedActions()) & $actions); |
1176 | 1176 | } |
1177 | 1177 | |
@@ -1224,7 +1224,7 @@ discard block |
||
1224 | 1224 | if ($ret = $this->groupPluginManager->deleteGroup($gid)) { |
1225 | 1225 | #delete group in nextcloud internal db |
1226 | 1226 | $this->access->getGroupMapper()->unmap($gid); |
1227 | - $this->access->connection->writeToCache("groupExists" . $gid, false); |
|
1227 | + $this->access->connection->writeToCache("groupExists".$gid, false); |
|
1228 | 1228 | } |
1229 | 1229 | return $ret; |
1230 | 1230 | } |
@@ -1304,7 +1304,7 @@ discard block |
||
1304 | 1304 | return $this->groupPluginManager->getDisplayName($gid); |
1305 | 1305 | } |
1306 | 1306 | |
1307 | - $cacheKey = 'group_getDisplayName' . $gid; |
|
1307 | + $cacheKey = 'group_getDisplayName'.$gid; |
|
1308 | 1308 | if (!is_null($displayName = $this->access->connection->getFromCache($cacheKey))) { |
1309 | 1309 | return $displayName; |
1310 | 1310 | } |
@@ -131,12 +131,12 @@ discard block |
||
131 | 131 | |
132 | 132 | sort($serverConnections); |
133 | 133 | $lastKey = array_pop($serverConnections); |
134 | - $lastNumber = (int)str_replace('s', '', $lastKey); |
|
135 | - return 's' . str_pad($lastNumber + 1, 2, '0', STR_PAD_LEFT); |
|
134 | + $lastNumber = (int) str_replace('s', '', $lastKey); |
|
135 | + return 's'.str_pad($lastNumber + 1, 2, '0', STR_PAD_LEFT); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | private function getServersConfig($value) { |
139 | - $regex = '/' . $value . '$/S'; |
|
139 | + $regex = '/'.$value.'$/S'; |
|
140 | 140 | |
141 | 141 | $keys = $this->config->getAppKeys('user_ldap'); |
142 | 142 | $result = []; |
@@ -169,11 +169,11 @@ discard block |
||
169 | 169 | DELETE |
170 | 170 | FROM `*PREFIX*appconfig` |
171 | 171 | WHERE `configkey` LIKE ? |
172 | - ' . $saveOtherConfigurations . ' |
|
172 | + ' . $saveOtherConfigurations.' |
|
173 | 173 | AND `appid` = \'user_ldap\' |
174 | 174 | AND `configkey` NOT IN (\'enabled\', \'installed_version\', \'types\', \'bgjUpdateGroupsLastRun\') |
175 | 175 | '); |
176 | - $delRows = $query->execute([$prefix . '%']); |
|
176 | + $delRows = $query->execute([$prefix.'%']); |
|
177 | 177 | |
178 | 178 | if ($delRows === null) { |
179 | 179 | return false; |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | } |
255 | 255 | |
256 | 256 | if (!is_string($dn)) { |
257 | - throw new \LogicException('String expected ' . \gettype($dn) . ' given'); |
|
257 | + throw new \LogicException('String expected '.\gettype($dn).' given'); |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | if (($sanitizedDn = $this->sanitizeDnCache->get($dn)) !== null) { |
@@ -35,6 +35,6 @@ |
||
35 | 35 | */ |
36 | 36 | protected function getTableName(bool $includePrefix = true) { |
37 | 37 | $p = $includePrefix ? '*PREFIX*' : ''; |
38 | - return $p . 'ldap_user_mapping'; |
|
38 | + return $p.'ldap_user_mapping'; |
|
39 | 39 | } |
40 | 40 | } |
@@ -89,9 +89,9 @@ discard block |
||
89 | 89 | throw new \Exception('Invalid Column Name'); |
90 | 90 | } |
91 | 91 | $query = $this->dbc->prepare(' |
92 | - SELECT `' . $fetchCol . '` |
|
93 | - FROM `' . $this->getTableName() . '` |
|
94 | - WHERE `' . $compareCol . '` = ? |
|
92 | + SELECT `' . $fetchCol.'` |
|
93 | + FROM `' . $this->getTableName().'` |
|
94 | + WHERE `' . $compareCol.'` = ? |
|
95 | 95 | '); |
96 | 96 | |
97 | 97 | $res = $query->execute([$search]); |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | public function setDNbyUUID($fdn, $uuid) { |
141 | 141 | $oldDn = $this->getDnByUUID($uuid); |
142 | 142 | $query = $this->dbc->prepare(' |
143 | - UPDATE `' . $this->getTableName() . '` |
|
143 | + UPDATE `' . $this->getTableName().'` |
|
144 | 144 | SET `ldap_dn` = ? |
145 | 145 | WHERE `directory_uuid` = ? |
146 | 146 | '); |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | */ |
167 | 167 | public function setUUIDbyDN($uuid, $fdn) { |
168 | 168 | $query = $this->dbc->prepare(' |
169 | - UPDATE `' . $this->getTableName() . '` |
|
169 | + UPDATE `' . $this->getTableName().'` |
|
170 | 170 | SET `directory_uuid` = ? |
171 | 171 | WHERE `ldap_dn` = ? |
172 | 172 | '); |
@@ -217,11 +217,11 @@ discard block |
||
217 | 217 | public function getNamesBySearch($search, $prefixMatch = "", $postfixMatch = "") { |
218 | 218 | $query = $this->dbc->prepare(' |
219 | 219 | SELECT `owncloud_name` |
220 | - FROM `' . $this->getTableName() . '` |
|
220 | + FROM `' . $this->getTableName().'` |
|
221 | 221 | WHERE `owncloud_name` LIKE ? |
222 | 222 | '); |
223 | 223 | |
224 | - $res = $query->execute([$prefixMatch . $this->dbc->escapeLikeParameter($search) . $postfixMatch]); |
|
224 | + $res = $query->execute([$prefixMatch.$this->dbc->escapeLikeParameter($search).$postfixMatch]); |
|
225 | 225 | $names = []; |
226 | 226 | if ($res !== false) { |
227 | 227 | while ($row = $query->fetch()) { |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | `ldap_dn` AS `dn`, |
270 | 270 | `owncloud_name` AS `name`, |
271 | 271 | `directory_uuid` AS `uuid` |
272 | - FROM `' . $this->getTableName() . '`', |
|
272 | + FROM `' . $this->getTableName().'`', |
|
273 | 273 | $limit, |
274 | 274 | $offset |
275 | 275 | ); |
@@ -306,11 +306,11 @@ discard block |
||
306 | 306 | |
307 | 307 | try { |
308 | 308 | $result = $this->dbc->insertIfNotExist($this->getTableName(), $row); |
309 | - if ((bool)$result === true) { |
|
309 | + if ((bool) $result === true) { |
|
310 | 310 | $this->cache[$fdn] = $name; |
311 | 311 | } |
312 | 312 | // insertIfNotExist returns values as int |
313 | - return (bool)$result; |
|
313 | + return (bool) $result; |
|
314 | 314 | } catch (\Exception $e) { |
315 | 315 | return false; |
316 | 316 | } |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | */ |
325 | 325 | public function unmap($name) { |
326 | 326 | $query = $this->dbc->prepare(' |
327 | - DELETE FROM `' . $this->getTableName() . '` |
|
327 | + DELETE FROM `' . $this->getTableName().'` |
|
328 | 328 | WHERE `owncloud_name` = ?'); |
329 | 329 | |
330 | 330 | return $this->modify($query, [$name]); |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | public function clear() { |
339 | 339 | $sql = $this->dbc |
340 | 340 | ->getDatabasePlatform() |
341 | - ->getTruncateTableSQL('`' . $this->getTableName() . '`'); |
|
341 | + ->getTruncateTableSQL('`'.$this->getTableName().'`'); |
|
342 | 342 | return $this->dbc->prepare($sql)->execute(); |
343 | 343 | } |
344 | 344 | |
@@ -380,6 +380,6 @@ discard block |
||
380 | 380 | $res = $query->execute(); |
381 | 381 | $count = $res->fetchColumn(); |
382 | 382 | $res->closeCursor(); |
383 | - return (int)$count; |
|
383 | + return (int) $count; |
|
384 | 384 | } |
385 | 385 | } |
@@ -35,6 +35,6 @@ |
||
35 | 35 | */ |
36 | 36 | protected function getTableName(bool $includePrefix = true) { |
37 | 37 | $p = $includePrefix ? '*PREFIX*' : ''; |
38 | - return $p . 'ldap_group_mapping'; |
|
38 | + return $p.'ldap_group_mapping'; |
|
39 | 39 | } |
40 | 40 | } |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | $this->abandonPagedSearch(); |
204 | 204 | // openLDAP requires that we init a new Paged Search. Not needed by AD, |
205 | 205 | // but does not hurt either. |
206 | - $pagingSize = (int)$this->connection->ldapPagingSize; |
|
206 | + $pagingSize = (int) $this->connection->ldapPagingSize; |
|
207 | 207 | // 0 won't result in replies, small numbers may leave out groups |
208 | 208 | // (cf. #12306), 500 is default for paging and should work everywhere. |
209 | 209 | $maxResults = $pagingSize > 20 ? $pagingSize : 500; |
@@ -244,13 +244,13 @@ discard block |
||
244 | 244 | return $values; |
245 | 245 | } else { |
246 | 246 | $low = $result['rangeHigh'] + 1; |
247 | - $attrToRead = $result['attributeName'] . ';range=' . $low . '-*'; |
|
247 | + $attrToRead = $result['attributeName'].';range='.$low.'-*'; |
|
248 | 248 | $isRangeRequest = true; |
249 | 249 | } |
250 | 250 | } |
251 | 251 | } while ($isRangeRequest); |
252 | 252 | |
253 | - \OCP\Util::writeLog('user_ldap', 'Requested attribute ' . $attr . ' not found for ' . $dn, ILogger::DEBUG); |
|
253 | + \OCP\Util::writeLog('user_ldap', 'Requested attribute '.$attr.' not found for '.$dn, ILogger::DEBUG); |
|
254 | 254 | return false; |
255 | 255 | } |
256 | 256 | |
@@ -274,13 +274,13 @@ discard block |
||
274 | 274 | if (!$this->ldap->isResource($rr)) { |
275 | 275 | if ($attribute !== '') { |
276 | 276 | //do not throw this message on userExists check, irritates |
277 | - \OCP\Util::writeLog('user_ldap', 'readAttribute failed for DN ' . $dn, ILogger::DEBUG); |
|
277 | + \OCP\Util::writeLog('user_ldap', 'readAttribute failed for DN '.$dn, ILogger::DEBUG); |
|
278 | 278 | } |
279 | 279 | //in case an error occurs , e.g. object does not exist |
280 | 280 | return false; |
281 | 281 | } |
282 | 282 | if ($attribute === '' && ($filter === 'objectclass=*' || $this->invokeLDAPMethod('countEntries', $cr, $rr) === 1)) { |
283 | - \OCP\Util::writeLog('user_ldap', 'readAttribute: ' . $dn . ' found', ILogger::DEBUG); |
|
283 | + \OCP\Util::writeLog('user_ldap', 'readAttribute: '.$dn.' found', ILogger::DEBUG); |
|
284 | 284 | return true; |
285 | 285 | } |
286 | 286 | $er = $this->invokeLDAPMethod('firstEntry', $cr, $rr); |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | * @throws \Exception |
361 | 361 | */ |
362 | 362 | public function setPassword($userDN, $password) { |
363 | - if ((int)$this->connection->turnOnPasswordChange !== 1) { |
|
363 | + if ((int) $this->connection->turnOnPasswordChange !== 1) { |
|
364 | 364 | throw new \Exception('LDAP password changes are disabled.'); |
365 | 365 | } |
366 | 366 | $cr = $this->connection->getConnectionResource(); |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | return @$this->invokeLDAPMethod('exopPasswd', $cr, $userDN, '', $password) || |
375 | 375 | @$this->invokeLDAPMethod('modReplace', $cr, $userDN, $password); |
376 | 376 | } catch (ConstraintViolationException $e) { |
377 | - throw new HintException('Password change rejected.', \OC::$server->getL10N('user_ldap')->t('Password change rejected. Hint: ') . $e->getMessage(), $e->getCode()); |
|
377 | + throw new HintException('Password change rejected.', \OC::$server->getL10N('user_ldap')->t('Password change rejected. Hint: ').$e->getMessage(), $e->getCode()); |
|
378 | 378 | } |
379 | 379 | } |
380 | 380 | |
@@ -540,21 +540,21 @@ discard block |
||
540 | 540 | } |
541 | 541 | } else { |
542 | 542 | //If the UUID can't be detected something is foul. |
543 | - \OCP\Util::writeLog('user_ldap', 'Cannot determine UUID for ' . $fdn . '. Skipping.', ILogger::INFO); |
|
543 | + \OCP\Util::writeLog('user_ldap', 'Cannot determine UUID for '.$fdn.'. Skipping.', ILogger::INFO); |
|
544 | 544 | return false; |
545 | 545 | } |
546 | 546 | |
547 | 547 | if (is_null($ldapName)) { |
548 | 548 | $ldapName = $this->readAttribute($fdn, $nameAttribute, $filter); |
549 | 549 | if (!isset($ldapName[0]) && empty($ldapName[0])) { |
550 | - \OCP\Util::writeLog('user_ldap', 'No or empty name for ' . $fdn . ' with filter ' . $filter . '.', ILogger::INFO); |
|
550 | + \OCP\Util::writeLog('user_ldap', 'No or empty name for '.$fdn.' with filter '.$filter.'.', ILogger::INFO); |
|
551 | 551 | return false; |
552 | 552 | } |
553 | 553 | $ldapName = $ldapName[0]; |
554 | 554 | } |
555 | 555 | |
556 | 556 | if ($isUser) { |
557 | - $usernameAttribute = (string)$this->connection->ldapExpertUsernameAttr; |
|
557 | + $usernameAttribute = (string) $this->connection->ldapExpertUsernameAttr; |
|
558 | 558 | if ($usernameAttribute !== '') { |
559 | 559 | $username = $this->readAttribute($fdn, $usernameAttribute); |
560 | 560 | $username = $username[0]; |
@@ -606,7 +606,7 @@ discard block |
||
606 | 606 | } |
607 | 607 | |
608 | 608 | //if everything else did not help.. |
609 | - \OCP\Util::writeLog('user_ldap', 'Could not create unique name for ' . $fdn . '.', ILogger::INFO); |
|
609 | + \OCP\Util::writeLog('user_ldap', 'Could not create unique name for '.$fdn.'.', ILogger::INFO); |
|
610 | 610 | return false; |
611 | 611 | } |
612 | 612 | |
@@ -721,7 +721,7 @@ discard block |
||
721 | 721 | * @param string|false $home the home directory path |
722 | 722 | */ |
723 | 723 | public function cacheUserHome($ocName, $home) { |
724 | - $cacheKey = 'getHome' . $ocName; |
|
724 | + $cacheKey = 'getHome'.$ocName; |
|
725 | 725 | $this->connection->writeToCache($cacheKey, $home); |
726 | 726 | } |
727 | 727 | |
@@ -731,14 +731,14 @@ discard block |
||
731 | 731 | * @param string $ocName the internal Nextcloud username |
732 | 732 | */ |
733 | 733 | public function cacheUserExists($ocName) { |
734 | - $this->connection->writeToCache('userExists' . $ocName, true); |
|
734 | + $this->connection->writeToCache('userExists'.$ocName, true); |
|
735 | 735 | } |
736 | 736 | |
737 | 737 | /** |
738 | 738 | * caches a group as existing |
739 | 739 | */ |
740 | 740 | public function cacheGroupExists(string $gid): void { |
741 | - $this->connection->writeToCache('groupExists' . $gid, true); |
|
741 | + $this->connection->writeToCache('groupExists'.$gid, true); |
|
742 | 742 | } |
743 | 743 | |
744 | 744 | /** |
@@ -756,11 +756,11 @@ discard block |
||
756 | 756 | } |
757 | 757 | $displayName = $user->composeAndStoreDisplayName($displayName, $displayName2); |
758 | 758 | $cacheKeyTrunk = 'getDisplayName'; |
759 | - $this->connection->writeToCache($cacheKeyTrunk . $ocName, $displayName); |
|
759 | + $this->connection->writeToCache($cacheKeyTrunk.$ocName, $displayName); |
|
760 | 760 | } |
761 | 761 | |
762 | 762 | public function cacheGroupDisplayName(string $ncName, string $displayName): void { |
763 | - $cacheKey = 'group_getDisplayName' . $ncName; |
|
763 | + $cacheKey = 'group_getDisplayName'.$ncName; |
|
764 | 764 | $this->connection->writeToCache($cacheKey, $displayName); |
765 | 765 | } |
766 | 766 | |
@@ -778,7 +778,7 @@ discard block |
||
778 | 778 | //while loop is just a precaution. If a name is not generated within |
779 | 779 | //20 attempts, something else is very wrong. Avoids infinite loop. |
780 | 780 | while ($attempts < 20) { |
781 | - $altName = $name . '_' . rand(1000, 9999); |
|
781 | + $altName = $name.'_'.rand(1000, 9999); |
|
782 | 782 | if (!$this->ncUserManager->userExists($altName)) { |
783 | 783 | return $altName; |
784 | 784 | } |
@@ -807,9 +807,9 @@ discard block |
||
807 | 807 | } else { |
808 | 808 | natsort($usedNames); |
809 | 809 | $lastName = array_pop($usedNames); |
810 | - $lastNo = (int)substr($lastName, strrpos($lastName, '_') + 1); |
|
810 | + $lastNo = (int) substr($lastName, strrpos($lastName, '_') + 1); |
|
811 | 811 | } |
812 | - $altName = $name . '_' . (string)($lastNo + 1); |
|
812 | + $altName = $name.'_'.(string) ($lastNo + 1); |
|
813 | 813 | unset($usedNames); |
814 | 814 | |
815 | 815 | $attempts = 1; |
@@ -820,7 +820,7 @@ discard block |
||
820 | 820 | if (!\OC::$server->getGroupManager()->groupExists($altName)) { |
821 | 821 | return $altName; |
822 | 822 | } |
823 | - $altName = $name . '_' . ($lastNo + $attempts); |
|
823 | + $altName = $name.'_'.($lastNo + $attempts); |
|
824 | 824 | $attempts++; |
825 | 825 | } |
826 | 826 | return false; |
@@ -888,12 +888,12 @@ discard block |
||
888 | 888 | if (!$forceApplyAttributes) { |
889 | 889 | $isBackgroundJobModeAjax = $this->config |
890 | 890 | ->getAppValue('core', 'backgroundjobs_mode', 'ajax') === 'ajax'; |
891 | - $listOfDNs = array_reduce($ldapRecords, function ($listOfDNs, $entry) { |
|
891 | + $listOfDNs = array_reduce($ldapRecords, function($listOfDNs, $entry) { |
|
892 | 892 | $listOfDNs[] = $entry['dn'][0]; |
893 | 893 | return $listOfDNs; |
894 | 894 | }, []); |
895 | 895 | $idsByDn = $this->userMapper->getListOfIdsByDn($listOfDNs); |
896 | - $recordsToUpdate = array_filter($ldapRecords, function ($record) use ($isBackgroundJobModeAjax, $idsByDn) { |
|
896 | + $recordsToUpdate = array_filter($ldapRecords, function($record) use ($isBackgroundJobModeAjax, $idsByDn) { |
|
897 | 897 | $newlyMapped = false; |
898 | 898 | $uid = $idsByDn[$record['dn'][0]] ?? null; |
899 | 899 | if ($uid === null) { |
@@ -951,13 +951,13 @@ discard block |
||
951 | 951 | public function fetchListOfGroups($filter, $attr, $limit = null, $offset = null) { |
952 | 952 | $groupRecords = $this->searchGroups($filter, $attr, $limit, $offset); |
953 | 953 | |
954 | - $listOfDNs = array_reduce($groupRecords, function ($listOfDNs, $entry) { |
|
954 | + $listOfDNs = array_reduce($groupRecords, function($listOfDNs, $entry) { |
|
955 | 955 | $listOfDNs[] = $entry['dn'][0]; |
956 | 956 | return $listOfDNs; |
957 | 957 | }, []); |
958 | 958 | $idsByDn = $this->groupMapper->getListOfIdsByDn($listOfDNs); |
959 | 959 | |
960 | - array_walk($groupRecords, function ($record) use ($idsByDn) { |
|
960 | + array_walk($groupRecords, function($record) use ($idsByDn) { |
|
961 | 961 | $newlyMapped = false; |
962 | 962 | $gid = $uidsByDn[$record['dn'][0]] ?? null; |
963 | 963 | if ($gid === null) { |
@@ -980,7 +980,7 @@ discard block |
||
980 | 980 | if ($manyAttributes) { |
981 | 981 | return $list; |
982 | 982 | } else { |
983 | - $list = array_reduce($list, function ($carry, $item) { |
|
983 | + $list = array_reduce($list, function($carry, $item) { |
|
984 | 984 | $attribute = array_keys($item)[0]; |
985 | 985 | $carry[] = $item[$attribute][0]; |
986 | 986 | return $carry; |
@@ -1025,7 +1025,7 @@ discard block |
||
1025 | 1025 | $result = false; |
1026 | 1026 | foreach ($this->connection->ldapBaseUsers as $base) { |
1027 | 1027 | $count = $this->count($filter, [$base], $attr, $limit, $offset); |
1028 | - $result = is_int($count) ? (int)$result + $count : $result; |
|
1028 | + $result = is_int($count) ? (int) $result + $count : $result; |
|
1029 | 1029 | } |
1030 | 1030 | return $result; |
1031 | 1031 | } |
@@ -1064,7 +1064,7 @@ discard block |
||
1064 | 1064 | $result = false; |
1065 | 1065 | foreach ($this->connection->ldapBaseGroups as $base) { |
1066 | 1066 | $count = $this->count($filter, [$base], $attr, $limit, $offset); |
1067 | - $result = is_int($count) ? (int)$result + $count : $result; |
|
1067 | + $result = is_int($count) ? (int) $result + $count : $result; |
|
1068 | 1068 | } |
1069 | 1069 | return $result; |
1070 | 1070 | } |
@@ -1081,7 +1081,7 @@ discard block |
||
1081 | 1081 | $result = false; |
1082 | 1082 | foreach ($this->connection->ldapBase as $base) { |
1083 | 1083 | $count = $this->count('objectclass=*', [$base], ['dn'], $limit, $offset); |
1084 | - $result = is_int($count) ? (int)$result + $count : $result; |
|
1084 | + $result = is_int($count) ? (int) $result + $count : $result; |
|
1085 | 1085 | } |
1086 | 1086 | return $result; |
1087 | 1087 | } |
@@ -1107,7 +1107,7 @@ discard block |
||
1107 | 1107 | // php no longer supports call-time pass-by-reference |
1108 | 1108 | // thus cannot support controlPagedResultResponse as the third argument |
1109 | 1109 | // is a reference |
1110 | - $doMethod = function () use ($command, &$arguments) { |
|
1110 | + $doMethod = function() use ($command, &$arguments) { |
|
1111 | 1111 | if ($command == 'controlPagedResultResponse') { |
1112 | 1112 | throw new \InvalidArgumentException('Invoker does not support controlPagedResultResponse, call LDAP Wrapper directly instead.'); |
1113 | 1113 | } else { |
@@ -1166,13 +1166,13 @@ discard block |
||
1166 | 1166 | } |
1167 | 1167 | |
1168 | 1168 | //check whether paged search should be attempted |
1169 | - $pagedSearchOK = $this->initPagedSearch($filter, $base, $attr, (int)$limit, (int)$offset); |
|
1169 | + $pagedSearchOK = $this->initPagedSearch($filter, $base, $attr, (int) $limit, (int) $offset); |
|
1170 | 1170 | |
1171 | 1171 | $sr = $this->invokeLDAPMethod('search', $cr, $base, $filter, $attr); |
1172 | 1172 | // cannot use $cr anymore, might have changed in the previous call! |
1173 | 1173 | $error = $this->ldap->errno($this->connection->getConnectionResource()); |
1174 | 1174 | if (!$this->ldap->isResource($sr) || $error !== 0) { |
1175 | - \OCP\Util::writeLog('user_ldap', 'Attempt for Paging? ' . print_r($pagedSearchOK, true), ILogger::ERROR); |
|
1175 | + \OCP\Util::writeLog('user_ldap', 'Attempt for Paging? '.print_r($pagedSearchOK, true), ILogger::ERROR); |
|
1176 | 1176 | return false; |
1177 | 1177 | } |
1178 | 1178 | |
@@ -1216,7 +1216,7 @@ discard block |
||
1216 | 1216 | $this->pagedSearchedSuccessful = true; |
1217 | 1217 | } |
1218 | 1218 | } else { |
1219 | - if (!is_null($limit) && (int)$this->connection->ldapPagingSize !== 0) { |
|
1219 | + if (!is_null($limit) && (int) $this->connection->ldapPagingSize !== 0) { |
|
1220 | 1220 | \OC::$server->getLogger()->debug( |
1221 | 1221 | 'Paged search was not available', |
1222 | 1222 | ['app' => 'user_ldap'] |
@@ -1262,7 +1262,7 @@ discard block |
||
1262 | 1262 | $attr = [mb_strtolower($attr, 'UTF-8')]; |
1263 | 1263 | } |
1264 | 1264 | |
1265 | - $limitPerPage = (int)$this->connection->ldapPagingSize; |
|
1265 | + $limitPerPage = (int) $this->connection->ldapPagingSize; |
|
1266 | 1266 | if (!is_null($limit) && $limit < $limitPerPage && $limit > 0) { |
1267 | 1267 | $limitPerPage = $limit; |
1268 | 1268 | } |
@@ -1304,7 +1304,7 @@ discard block |
||
1304 | 1304 | * @throws ServerNotAvailableException |
1305 | 1305 | */ |
1306 | 1306 | private function countEntriesInSearchResults($sr): int { |
1307 | - return (int)$this->invokeLDAPMethod('countEntries', $this->connection->getConnectionResource(), $sr); |
|
1307 | + return (int) $this->invokeLDAPMethod('countEntries', $this->connection->getConnectionResource(), $sr); |
|
1308 | 1308 | } |
1309 | 1309 | |
1310 | 1310 | /** |
@@ -1320,7 +1320,7 @@ discard block |
||
1320 | 1320 | ?int $offset = null, |
1321 | 1321 | bool $skipHandling = false |
1322 | 1322 | ): array { |
1323 | - $limitPerPage = (int)$this->connection->ldapPagingSize; |
|
1323 | + $limitPerPage = (int) $this->connection->ldapPagingSize; |
|
1324 | 1324 | if (!is_null($limit) && $limit < $limitPerPage && $limit > 0) { |
1325 | 1325 | $limitPerPage = $limit; |
1326 | 1326 | } |
@@ -1412,7 +1412,7 @@ discard block |
||
1412 | 1412 | && !is_null($limit) |
1413 | 1413 | ) |
1414 | 1414 | ) { |
1415 | - $findings = array_slice($findings, (int)$offset, $limit); |
|
1415 | + $findings = array_slice($findings, (int) $offset, $limit); |
|
1416 | 1416 | } |
1417 | 1417 | return $findings; |
1418 | 1418 | } |
@@ -1464,7 +1464,7 @@ discard block |
||
1464 | 1464 | } |
1465 | 1465 | $search = ['*', '\\', '(', ')']; |
1466 | 1466 | $replace = ['\\*', '\\\\', '\\(', '\\)']; |
1467 | - return $asterisk . str_replace($search, $replace, $input); |
|
1467 | + return $asterisk.str_replace($search, $replace, $input); |
|
1468 | 1468 | } |
1469 | 1469 | |
1470 | 1470 | /** |
@@ -1496,10 +1496,10 @@ discard block |
||
1496 | 1496 | * @return string the combined filter |
1497 | 1497 | */ |
1498 | 1498 | private function combineFilter($filters, $operator) { |
1499 | - $combinedFilter = '(' . $operator; |
|
1499 | + $combinedFilter = '('.$operator; |
|
1500 | 1500 | foreach ($filters as $filter) { |
1501 | 1501 | if ($filter !== '' && $filter[0] !== '(') { |
1502 | - $filter = '(' . $filter . ')'; |
|
1502 | + $filter = '('.$filter.')'; |
|
1503 | 1503 | } |
1504 | 1504 | $combinedFilter .= $filter; |
1505 | 1505 | } |
@@ -1552,7 +1552,7 @@ discard block |
||
1552 | 1552 | //every word needs to appear at least once |
1553 | 1553 | $wordMatchOneAttrFilters = []; |
1554 | 1554 | foreach ($searchAttributes as $attr) { |
1555 | - $wordMatchOneAttrFilters[] = $attr . '=' . $word; |
|
1555 | + $wordMatchOneAttrFilters[] = $attr.'='.$word; |
|
1556 | 1556 | } |
1557 | 1557 | $wordFilters[] = $this->combineFilterWithOr($wordMatchOneAttrFilters); |
1558 | 1558 | } |
@@ -1588,14 +1588,14 @@ discard block |
||
1588 | 1588 | if ($fallbackAttribute === '') { |
1589 | 1589 | return ''; |
1590 | 1590 | } |
1591 | - $filter[] = $fallbackAttribute . '=' . $search; |
|
1591 | + $filter[] = $fallbackAttribute.'='.$search; |
|
1592 | 1592 | } else { |
1593 | 1593 | foreach ($searchAttributes as $attribute) { |
1594 | - $filter[] = $attribute . '=' . $search; |
|
1594 | + $filter[] = $attribute.'='.$search; |
|
1595 | 1595 | } |
1596 | 1596 | } |
1597 | 1597 | if (count($filter) === 1) { |
1598 | - return '(' . $filter[0] . ')'; |
|
1598 | + return '('.$filter[0].')'; |
|
1599 | 1599 | } |
1600 | 1600 | return $this->combineFilterWithOr($filter); |
1601 | 1601 | } |
@@ -1616,7 +1616,7 @@ discard block |
||
1616 | 1616 | if ($term === '') { |
1617 | 1617 | $result = '*'; |
1618 | 1618 | } elseif ($allowEnum !== 'no') { |
1619 | - $result = $term . '*'; |
|
1619 | + $result = $term.'*'; |
|
1620 | 1620 | } |
1621 | 1621 | return $result; |
1622 | 1622 | } |
@@ -1629,7 +1629,7 @@ discard block |
||
1629 | 1629 | public function getFilterForUserCount() { |
1630 | 1630 | $filter = $this->combineFilterWithAnd([ |
1631 | 1631 | $this->connection->ldapUserFilter, |
1632 | - $this->connection->ldapUserDisplayName . '=*' |
|
1632 | + $this->connection->ldapUserDisplayName.'=*' |
|
1633 | 1633 | ]); |
1634 | 1634 | |
1635 | 1635 | return $filter; |
@@ -1695,7 +1695,7 @@ discard block |
||
1695 | 1695 | $uuid = $this->formatGuid2ForFilterUser($uuid); |
1696 | 1696 | } |
1697 | 1697 | |
1698 | - $filter = $uuidAttr . '=' . $uuid; |
|
1698 | + $filter = $uuidAttr.'='.$uuid; |
|
1699 | 1699 | $result = $this->searchUsers($filter, ['dn'], 2); |
1700 | 1700 | if (is_array($result) && isset($result[0]) && isset($result[0]['dn']) && count($result) === 1) { |
1701 | 1701 | // we put the count into account to make sure that this is |
@@ -1825,8 +1825,8 @@ discard block |
||
1825 | 1825 | for ($k = 1; $k <= 2; ++$k) { |
1826 | 1826 | $hex_guid_to_guid_str .= substr($hex_guid, 16 - 2 * $k, 2); |
1827 | 1827 | } |
1828 | - $hex_guid_to_guid_str .= '-' . substr($hex_guid, 16, 4); |
|
1829 | - $hex_guid_to_guid_str .= '-' . substr($hex_guid, 20); |
|
1828 | + $hex_guid_to_guid_str .= '-'.substr($hex_guid, 16, 4); |
|
1829 | + $hex_guid_to_guid_str .= '-'.substr($hex_guid, 20); |
|
1830 | 1830 | |
1831 | 1831 | return strtoupper($hex_guid_to_guid_str); |
1832 | 1832 | } |
@@ -1860,7 +1860,7 @@ discard block |
||
1860 | 1860 | * user. Instead we write a log message. |
1861 | 1861 | */ |
1862 | 1862 | \OC::$server->getLogger()->info( |
1863 | - 'Passed string does not resemble a valid GUID. Known UUID ' . |
|
1863 | + 'Passed string does not resemble a valid GUID. Known UUID '. |
|
1864 | 1864 | '({uuid}) probably does not match UUID configuration.', |
1865 | 1865 | ['app' => 'user_ldap', 'uuid' => $guid] |
1866 | 1866 | ); |
@@ -1873,7 +1873,7 @@ discard block |
||
1873 | 1873 | } |
1874 | 1874 | for ($i = 0; $i < 5; $i++) { |
1875 | 1875 | $pairs = str_split($blocks[$i], 2); |
1876 | - $blocks[$i] = '\\' . implode('\\', $pairs); |
|
1876 | + $blocks[$i] = '\\'.implode('\\', $pairs); |
|
1877 | 1877 | } |
1878 | 1878 | return implode('', $blocks); |
1879 | 1879 | } |
@@ -1887,7 +1887,7 @@ discard block |
||
1887 | 1887 | */ |
1888 | 1888 | public function getSID($dn) { |
1889 | 1889 | $domainDN = $this->getDomainDNFromDN($dn); |
1890 | - $cacheKey = 'getSID-' . $domainDN; |
|
1890 | + $cacheKey = 'getSID-'.$domainDN; |
|
1891 | 1891 | $sid = $this->connection->getFromCache($cacheKey); |
1892 | 1892 | if (!is_null($sid)) { |
1893 | 1893 | return $sid; |
@@ -2075,7 +2075,7 @@ discard block |
||
2075 | 2075 | $this->abandonPagedSearch(); |
2076 | 2076 | // in case someone set it to 0 … use 500, otherwise no results will |
2077 | 2077 | // be returned. |
2078 | - $pageSize = (int)$this->connection->ldapPagingSize > 0 ? (int)$this->connection->ldapPagingSize : 500; |
|
2078 | + $pageSize = (int) $this->connection->ldapPagingSize > 0 ? (int) $this->connection->ldapPagingSize : 500; |
|
2079 | 2079 | $pagedSearchOK = $this->invokeLDAPMethod('controlPagedResult', |
2080 | 2080 | $this->connection->getConnectionResource(), |
2081 | 2081 | $pageSize, false); |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | * @return string |
108 | 108 | */ |
109 | 109 | protected function getUserCacheKey($uid) { |
110 | - return 'user-' . $uid . '-lastSeenOn'; |
|
110 | + return 'user-'.$uid.'-lastSeenOn'; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | /** |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | * @return string |
116 | 116 | */ |
117 | 117 | protected function getGroupCacheKey($gid) { |
118 | - return 'group-' . $gid . '-lastSeenOn'; |
|
118 | + return 'group-'.$gid.'-lastSeenOn'; |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | /** |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | if ($key === null) { |
179 | 179 | return $prefix; |
180 | 180 | } |
181 | - return $prefix . hash('sha256', $key); |
|
181 | + return $prefix.hash('sha256', $key); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | /** |