@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | 'edition' => '', |
| 96 | 96 | ); |
| 97 | 97 | |
| 98 | - if($this->userSession->isLoggedIn()) { |
|
| 98 | + if ($this->userSession->isLoggedIn()) { |
|
| 99 | 99 | $result['capabilities'] = $this->capabilitiesManager->getCapabilities(); |
| 100 | 100 | } else { |
| 101 | 101 | $result['capabilities'] = $this->capabilitiesManager->getCapabilities(true); |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | public function getIdentityProof($cloudId) { |
| 139 | 139 | $userObject = $this->userManager->get($cloudId); |
| 140 | 140 | |
| 141 | - if($userObject !== null) { |
|
| 141 | + if ($userObject !== null) { |
|
| 142 | 142 | $key = $this->keyManager->getKey($userObject); |
| 143 | 143 | $data = [ |
| 144 | 144 | 'public' => $key->getPublic(), |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | public function getCapabilities($public = false) { |
| 50 | 50 | $capabilities = []; |
| 51 | - foreach($this->capabilities as $capability) { |
|
| 51 | + foreach ($this->capabilities as $capability) { |
|
| 52 | 52 | try { |
| 53 | 53 | $c = $capability(); |
| 54 | 54 | } catch (QueryException $e) { |
@@ -57,11 +57,11 @@ discard block |
||
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | if ($c instanceof ICapability) { |
| 60 | - if(!$public || $c instanceof IPublicCapability) { |
|
| 60 | + if (!$public || $c instanceof IPublicCapability) { |
|
| 61 | 61 | $capabilities = array_replace_recursive($capabilities, $c->getCapabilities()); |
| 62 | 62 | } |
| 63 | 63 | } else { |
| 64 | - throw new \InvalidArgumentException('The given Capability (' . get_class($c) . ') does not implement the ICapability interface'); |
|
| 64 | + throw new \InvalidArgumentException('The given Capability ('.get_class($c).') does not implement the ICapability interface'); |
|
| 65 | 65 | } |
| 66 | 66 | } |
| 67 | 67 | |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | return array(); |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - $path = $this->getPathToCertificates() . 'uploads/'; |
|
| 93 | + $path = $this->getPathToCertificates().'uploads/'; |
|
| 94 | 94 | if (!$this->view->is_dir($path)) { |
| 95 | 95 | return array(); |
| 96 | 96 | } |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | while (false !== ($file = readdir($handle))) { |
| 103 | 103 | if ($file != '.' && $file != '..') { |
| 104 | 104 | try { |
| 105 | - $result[] = new Certificate($this->view->file_get_contents($path . $file), $file); |
|
| 105 | + $result[] = new Certificate($this->view->file_get_contents($path.$file), $file); |
|
| 106 | 106 | } catch (\Exception $e) { |
| 107 | 107 | } |
| 108 | 108 | } |
@@ -122,20 +122,20 @@ discard block |
||
| 122 | 122 | $this->view->mkdir($path); |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - $defaultCertificates = file_get_contents(\OC::$SERVERROOT . '/resources/config/ca-bundle.crt'); |
|
| 125 | + $defaultCertificates = file_get_contents(\OC::$SERVERROOT.'/resources/config/ca-bundle.crt'); |
|
| 126 | 126 | if (strlen($defaultCertificates) < 1024) { // sanity check to verify that we have some content for our bundle |
| 127 | 127 | // log as exception so we have a stacktrace |
| 128 | 128 | $this->logger->logException(new \Exception('Shipped ca-bundle is empty, refusing to create certificate bundle')); |
| 129 | 129 | return; |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | - $certPath = $path . 'rootcerts.crt'; |
|
| 133 | - $tmpPath = $certPath . '.tmp' . $this->random->generate(10, ISecureRandom::CHAR_DIGITS); |
|
| 132 | + $certPath = $path.'rootcerts.crt'; |
|
| 133 | + $tmpPath = $certPath.'.tmp'.$this->random->generate(10, ISecureRandom::CHAR_DIGITS); |
|
| 134 | 134 | $fhCerts = $this->view->fopen($tmpPath, 'w'); |
| 135 | 135 | |
| 136 | 136 | // Write user certificates |
| 137 | 137 | foreach ($certs as $cert) { |
| 138 | - $file = $path . '/uploads/' . $cert->getName(); |
|
| 138 | + $file = $path.'/uploads/'.$cert->getName(); |
|
| 139 | 139 | $data = $this->view->file_get_contents($file); |
| 140 | 140 | if (strpos($data, 'BEGIN CERTIFICATE')) { |
| 141 | 141 | fwrite($fhCerts, $data); |
@@ -171,13 +171,13 @@ discard block |
||
| 171 | 171 | throw new \Exception('Filename is not valid'); |
| 172 | 172 | } |
| 173 | 173 | |
| 174 | - $dir = $this->getPathToCertificates() . 'uploads/'; |
|
| 174 | + $dir = $this->getPathToCertificates().'uploads/'; |
|
| 175 | 175 | if (!$this->view->file_exists($dir)) { |
| 176 | 176 | $this->view->mkdir($dir); |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | try { |
| 180 | - $file = $dir . $name; |
|
| 180 | + $file = $dir.$name; |
|
| 181 | 181 | $certificateObject = new Certificate($certificate, $name); |
| 182 | 182 | $this->view->file_put_contents($file, $certificate); |
| 183 | 183 | $this->createCertificateBundle(); |
@@ -198,9 +198,9 @@ discard block |
||
| 198 | 198 | if (!Filesystem::isValidPath($name)) { |
| 199 | 199 | return false; |
| 200 | 200 | } |
| 201 | - $path = $this->getPathToCertificates() . 'uploads/'; |
|
| 202 | - if ($this->view->file_exists($path . $name)) { |
|
| 203 | - $this->view->unlink($path . $name); |
|
| 201 | + $path = $this->getPathToCertificates().'uploads/'; |
|
| 202 | + if ($this->view->file_exists($path.$name)) { |
|
| 203 | + $this->view->unlink($path.$name); |
|
| 204 | 204 | $this->createCertificateBundle(); |
| 205 | 205 | } |
| 206 | 206 | return true; |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | if ($uid === '') { |
| 217 | 217 | $uid = $this->uid; |
| 218 | 218 | } |
| 219 | - return $this->getPathToCertificates($uid) . 'rootcerts.crt'; |
|
| 219 | + return $this->getPathToCertificates($uid).'rootcerts.crt'; |
|
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | /** |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | if ($uid === '') { |
| 249 | 249 | $uid = $this->uid; |
| 250 | 250 | } |
| 251 | - $path = is_null($uid) ? '/files_external/' : '/' . $uid . '/files_external/'; |
|
| 251 | + $path = is_null($uid) ? '/files_external/' : '/'.$uid.'/files_external/'; |
|
| 252 | 252 | |
| 253 | 253 | return $path; |
| 254 | 254 | } |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | $sourceMTimes[] = $this->view->filemtime($this->getCertificateBundle(null)); |
| 275 | 275 | } |
| 276 | 276 | |
| 277 | - $sourceMTime = array_reduce($sourceMTimes, function ($max, $mtime) { |
|
| 277 | + $sourceMTime = array_reduce($sourceMTimes, function($max, $mtime) { |
|
| 278 | 278 | return max($max, $mtime); |
| 279 | 279 | }, 0); |
| 280 | 280 | return $sourceMTime > $this->view->filemtime($targetBundle); |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | * @return int |
| 287 | 287 | */ |
| 288 | 288 | protected function getFilemtimeOfCaBundle() { |
| 289 | - return filemtime(\OC::$SERVERROOT . '/resources/config/ca-bundle.crt'); |
|
| 289 | + return filemtime(\OC::$SERVERROOT.'/resources/config/ca-bundle.crt'); |
|
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | } |
@@ -67,8 +67,8 @@ discard block |
||
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | protected function registerHooks() { |
| 70 | - Util::connectHook('OC_User','pre_deleteUser', $this, 'preDeleteUser'); |
|
| 71 | - Util::connectHook('OC_User','post_deleteUser', $this, 'postDeleteUser'); |
|
| 70 | + Util::connectHook('OC_User', 'pre_deleteUser', $this, 'preDeleteUser'); |
|
| 71 | + Util::connectHook('OC_User', 'post_deleteUser', $this, 'postDeleteUser'); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | public function preDeleteUser(\OC\User\User $user) { |
@@ -86,10 +86,10 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | public function canChangeAvatar($uid) { |
| 88 | 88 | $user = $this->access->userManager->get($uid); |
| 89 | - if(!$user instanceof User) { |
|
| 89 | + if (!$user instanceof User) { |
|
| 90 | 90 | return false; |
| 91 | 91 | } |
| 92 | - if($user->getAvatarImage() === false) { |
|
| 92 | + if ($user->getAvatarImage() === false) { |
|
| 93 | 93 | return true; |
| 94 | 94 | } |
| 95 | 95 | |
@@ -105,14 +105,14 @@ discard block |
||
| 105 | 105 | public function loginName2UserName($loginName) { |
| 106 | 106 | $cacheKey = 'loginName2UserName-'.$loginName; |
| 107 | 107 | $username = $this->access->connection->getFromCache($cacheKey); |
| 108 | - if(!is_null($username)) { |
|
| 108 | + if (!is_null($username)) { |
|
| 109 | 109 | return $username; |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | try { |
| 113 | 113 | $ldapRecord = $this->getLDAPUserByLoginName($loginName); |
| 114 | 114 | $user = $this->access->userManager->get($ldapRecord['dn'][0]); |
| 115 | - if($user instanceof OfflineUser) { |
|
| 115 | + if ($user instanceof OfflineUser) { |
|
| 116 | 116 | // this path is not really possible, however get() is documented |
| 117 | 117 | // to return User or OfflineUser so we are very defensive here. |
| 118 | 118 | $this->access->connection->writeToCache($cacheKey, false); |
@@ -148,9 +148,9 @@ discard block |
||
| 148 | 148 | //find out dn of the user name |
| 149 | 149 | $attrs = $this->access->userManager->getAttributes(); |
| 150 | 150 | $users = $this->access->fetchUsersByLoginName($loginName, $attrs); |
| 151 | - if(count($users) < 1) { |
|
| 152 | - throw new NotOnLDAP('No user available for the given login name on ' . |
|
| 153 | - $this->access->connection->ldapHost . ':' . $this->access->connection->ldapPort); |
|
| 151 | + if (count($users) < 1) { |
|
| 152 | + throw new NotOnLDAP('No user available for the given login name on '. |
|
| 153 | + $this->access->connection->ldapHost.':'.$this->access->connection->ldapPort); |
|
| 154 | 154 | } |
| 155 | 155 | return $users[0]; |
| 156 | 156 | } |
@@ -165,8 +165,8 @@ discard block |
||
| 165 | 165 | public function checkPassword($uid, $password) { |
| 166 | 166 | try { |
| 167 | 167 | $ldapRecord = $this->getLDAPUserByLoginName($uid); |
| 168 | - } catch(NotOnLDAP $e) { |
|
| 169 | - if($this->ocConfig->getSystemValue('loglevel', Util::WARN) === Util::DEBUG) { |
|
| 168 | + } catch (NotOnLDAP $e) { |
|
| 169 | + if ($this->ocConfig->getSystemValue('loglevel', Util::WARN) === Util::DEBUG) { |
|
| 170 | 170 | \OC::$server->getLogger()->logException($e, ['app' => 'user_ldap']); |
| 171 | 171 | } |
| 172 | 172 | return false; |
@@ -174,16 +174,16 @@ discard block |
||
| 174 | 174 | $dn = $ldapRecord['dn'][0]; |
| 175 | 175 | $user = $this->access->userManager->get($dn); |
| 176 | 176 | |
| 177 | - if(!$user instanceof User) { |
|
| 177 | + if (!$user instanceof User) { |
|
| 178 | 178 | Util::writeLog('user_ldap', |
| 179 | - 'LDAP Login: Could not get user object for DN ' . $dn . |
|
| 179 | + 'LDAP Login: Could not get user object for DN '.$dn. |
|
| 180 | 180 | '. Maybe the LDAP entry has no set display name attribute?', |
| 181 | 181 | Util::WARN); |
| 182 | 182 | return false; |
| 183 | 183 | } |
| 184 | - if($user->getUsername() !== false) { |
|
| 184 | + if ($user->getUsername() !== false) { |
|
| 185 | 185 | //are the credentials OK? |
| 186 | - if(!$this->access->areCredentialsValid($dn, $password)) { |
|
| 186 | + if (!$this->access->areCredentialsValid($dn, $password)) { |
|
| 187 | 187 | return false; |
| 188 | 188 | } |
| 189 | 189 | |
@@ -206,11 +206,11 @@ discard block |
||
| 206 | 206 | public function setPassword($uid, $password) { |
| 207 | 207 | $user = $this->access->userManager->get($uid); |
| 208 | 208 | |
| 209 | - if(!$user instanceof User) { |
|
| 210 | - throw new \Exception('LDAP setPassword: Could not get user object for uid ' . $uid . |
|
| 209 | + if (!$user instanceof User) { |
|
| 210 | + throw new \Exception('LDAP setPassword: Could not get user object for uid '.$uid. |
|
| 211 | 211 | '. Maybe the LDAP entry has no set display name attribute?'); |
| 212 | 212 | } |
| 213 | - if($user->getUsername() !== false && $this->access->setPassword($user->getDN(), $password)) { |
|
| 213 | + if ($user->getUsername() !== false && $this->access->setPassword($user->getDN(), $password)) { |
|
| 214 | 214 | $ldapDefaultPPolicyDN = $this->access->connection->ldapDefaultPPolicyDN; |
| 215 | 215 | $turnOnPasswordChange = $this->access->connection->turnOnPasswordChange; |
| 216 | 216 | if (!empty($ldapDefaultPPolicyDN) && (intval($turnOnPasswordChange) === 1)) { |
@@ -242,18 +242,18 @@ discard block |
||
| 242 | 242 | |
| 243 | 243 | //check if users are cached, if so return |
| 244 | 244 | $ldap_users = $this->access->connection->getFromCache($cachekey); |
| 245 | - if(!is_null($ldap_users)) { |
|
| 245 | + if (!is_null($ldap_users)) { |
|
| 246 | 246 | return $ldap_users; |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | // if we'd pass -1 to LDAP search, we'd end up in a Protocol |
| 250 | 250 | // error. With a limit of 0, we get 0 results. So we pass null. |
| 251 | - if($limit <= 0) { |
|
| 251 | + if ($limit <= 0) { |
|
| 252 | 252 | $limit = null; |
| 253 | 253 | } |
| 254 | 254 | $filter = $this->access->combineFilterWithAnd(array( |
| 255 | 255 | $this->access->connection->ldapUserFilter, |
| 256 | - $this->access->connection->ldapUserDisplayName . '=*', |
|
| 256 | + $this->access->connection->ldapUserDisplayName.'=*', |
|
| 257 | 257 | $this->access->getFilterPartForUserSearch($search) |
| 258 | 258 | )); |
| 259 | 259 | |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | $this->access->userManager->getAttributes(true), |
| 267 | 267 | $limit, $offset); |
| 268 | 268 | $ldap_users = $this->access->nextcloudUserNames($ldap_users); |
| 269 | - Util::writeLog('user_ldap', 'getUsers: '.count($ldap_users). ' Users found', Util::DEBUG); |
|
| 269 | + Util::writeLog('user_ldap', 'getUsers: '.count($ldap_users).' Users found', Util::DEBUG); |
|
| 270 | 270 | |
| 271 | 271 | $this->access->connection->writeToCache($cachekey, $ldap_users); |
| 272 | 272 | return $ldap_users; |
@@ -282,29 +282,29 @@ discard block |
||
| 282 | 282 | * @throws \OC\ServerNotAvailableException |
| 283 | 283 | */ |
| 284 | 284 | public function userExistsOnLDAP($user) { |
| 285 | - if(is_string($user)) { |
|
| 285 | + if (is_string($user)) { |
|
| 286 | 286 | $user = $this->access->userManager->get($user); |
| 287 | 287 | } |
| 288 | - if(is_null($user)) { |
|
| 288 | + if (is_null($user)) { |
|
| 289 | 289 | return false; |
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | $dn = $user->getDN(); |
| 293 | 293 | //check if user really still exists by reading its entry |
| 294 | - if(!is_array($this->access->readAttribute($dn, '', $this->access->connection->ldapUserFilter))) { |
|
| 294 | + if (!is_array($this->access->readAttribute($dn, '', $this->access->connection->ldapUserFilter))) { |
|
| 295 | 295 | $lcr = $this->access->connection->getConnectionResource(); |
| 296 | - if(is_null($lcr)) { |
|
| 297 | - throw new \Exception('No LDAP Connection to server ' . $this->access->connection->ldapHost); |
|
| 296 | + if (is_null($lcr)) { |
|
| 297 | + throw new \Exception('No LDAP Connection to server '.$this->access->connection->ldapHost); |
|
| 298 | 298 | } |
| 299 | 299 | |
| 300 | 300 | try { |
| 301 | 301 | $uuid = $this->access->getUserMapper()->getUUIDByDN($dn); |
| 302 | - if(!$uuid) { |
|
| 302 | + if (!$uuid) { |
|
| 303 | 303 | return false; |
| 304 | 304 | } |
| 305 | 305 | $newDn = $this->access->getUserDnByUuid($uuid); |
| 306 | 306 | //check if renamed user is still valid by reapplying the ldap filter |
| 307 | - if(!is_array($this->access->readAttribute($newDn, '', $this->access->connection->ldapUserFilter))) { |
|
| 307 | + if (!is_array($this->access->readAttribute($newDn, '', $this->access->connection->ldapUserFilter))) { |
|
| 308 | 308 | return false; |
| 309 | 309 | } |
| 310 | 310 | $this->access->getUserMapper()->setDNbyUUID($newDn, $uuid); |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | } |
| 315 | 315 | } |
| 316 | 316 | |
| 317 | - if($user instanceof OfflineUser) { |
|
| 317 | + if ($user instanceof OfflineUser) { |
|
| 318 | 318 | $user->unmark(); |
| 319 | 319 | } |
| 320 | 320 | |
@@ -329,18 +329,18 @@ discard block |
||
| 329 | 329 | */ |
| 330 | 330 | public function userExists($uid) { |
| 331 | 331 | $userExists = $this->access->connection->getFromCache('userExists'.$uid); |
| 332 | - if(!is_null($userExists)) { |
|
| 333 | - return (bool)$userExists; |
|
| 332 | + if (!is_null($userExists)) { |
|
| 333 | + return (bool) $userExists; |
|
| 334 | 334 | } |
| 335 | 335 | //getting dn, if false the user does not exist. If dn, he may be mapped only, requires more checking. |
| 336 | 336 | $user = $this->access->userManager->get($uid); |
| 337 | 337 | |
| 338 | - if(is_null($user)) { |
|
| 338 | + if (is_null($user)) { |
|
| 339 | 339 | Util::writeLog('user_ldap', 'No DN found for '.$uid.' on '. |
| 340 | 340 | $this->access->connection->ldapHost, Util::DEBUG); |
| 341 | 341 | $this->access->connection->writeToCache('userExists'.$uid, false); |
| 342 | 342 | return false; |
| 343 | - } else if($user instanceof OfflineUser) { |
|
| 343 | + } else if ($user instanceof OfflineUser) { |
|
| 344 | 344 | //express check for users marked as deleted. Returning true is |
| 345 | 345 | //necessary for cleanup |
| 346 | 346 | return true; |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | |
| 349 | 349 | $result = $this->userExistsOnLDAP($user); |
| 350 | 350 | $this->access->connection->writeToCache('userExists'.$uid, $result); |
| 351 | - if($result === true) { |
|
| 351 | + if ($result === true) { |
|
| 352 | 352 | $user->update(); |
| 353 | 353 | } |
| 354 | 354 | return $result; |
@@ -362,13 +362,13 @@ discard block |
||
| 362 | 362 | */ |
| 363 | 363 | public function deleteUser($uid) { |
| 364 | 364 | $marked = $this->ocConfig->getUserValue($uid, 'user_ldap', 'isDeleted', 0); |
| 365 | - if(intval($marked) === 0) { |
|
| 365 | + if (intval($marked) === 0) { |
|
| 366 | 366 | \OC::$server->getLogger()->notice( |
| 367 | - 'User '.$uid . ' is not marked as deleted, not cleaning up.', |
|
| 367 | + 'User '.$uid.' is not marked as deleted, not cleaning up.', |
|
| 368 | 368 | array('app' => 'user_ldap')); |
| 369 | 369 | return false; |
| 370 | 370 | } |
| 371 | - \OC::$server->getLogger()->info('Cleaning up after user ' . $uid, |
|
| 371 | + \OC::$server->getLogger()->info('Cleaning up after user '.$uid, |
|
| 372 | 372 | array('app' => 'user_ldap')); |
| 373 | 373 | |
| 374 | 374 | //Get Home Directory out of user preferences so we can return it later, |
@@ -387,26 +387,26 @@ discard block |
||
| 387 | 387 | */ |
| 388 | 388 | public function getHome($uid) { |
| 389 | 389 | // user Exists check required as it is not done in user proxy! |
| 390 | - if(!$this->userExists($uid)) { |
|
| 390 | + if (!$this->userExists($uid)) { |
|
| 391 | 391 | return false; |
| 392 | 392 | } |
| 393 | 393 | |
| 394 | 394 | $cacheKey = 'getHome'.$uid; |
| 395 | 395 | $path = $this->access->connection->getFromCache($cacheKey); |
| 396 | - if(!is_null($path)) { |
|
| 396 | + if (!is_null($path)) { |
|
| 397 | 397 | return $path; |
| 398 | 398 | } |
| 399 | 399 | |
| 400 | 400 | // early return path if it is a deleted user |
| 401 | 401 | $user = $this->access->userManager->get($uid); |
| 402 | - if($user instanceof OfflineUser) { |
|
| 403 | - if($this->currentUserInDeletionProcess === $user->getUID()) { |
|
| 402 | + if ($user instanceof OfflineUser) { |
|
| 403 | + if ($this->currentUserInDeletionProcess === $user->getUID()) { |
|
| 404 | 404 | return $user->getHomePath(); |
| 405 | 405 | } else { |
| 406 | - throw new NoUserException($uid . ' is not a valid user anymore'); |
|
| 406 | + throw new NoUserException($uid.' is not a valid user anymore'); |
|
| 407 | 407 | } |
| 408 | 408 | } else if ($user === null) { |
| 409 | - throw new NoUserException($uid . ' is not a valid user anymore'); |
|
| 409 | + throw new NoUserException($uid.' is not a valid user anymore'); |
|
| 410 | 410 | } |
| 411 | 411 | |
| 412 | 412 | $path = $user->getHomePath(); |
@@ -421,12 +421,12 @@ discard block |
||
| 421 | 421 | * @return string|false display name |
| 422 | 422 | */ |
| 423 | 423 | public function getDisplayName($uid) { |
| 424 | - if(!$this->userExists($uid)) { |
|
| 424 | + if (!$this->userExists($uid)) { |
|
| 425 | 425 | return false; |
| 426 | 426 | } |
| 427 | 427 | |
| 428 | 428 | $cacheKey = 'getDisplayName'.$uid; |
| 429 | - if(!is_null($displayName = $this->access->connection->getFromCache($cacheKey))) { |
|
| 429 | + if (!is_null($displayName = $this->access->connection->getFromCache($cacheKey))) { |
|
| 430 | 430 | return $displayName; |
| 431 | 431 | } |
| 432 | 432 | |
@@ -443,10 +443,10 @@ discard block |
||
| 443 | 443 | $this->access->username2dn($uid), |
| 444 | 444 | $this->access->connection->ldapUserDisplayName); |
| 445 | 445 | |
| 446 | - if($displayName && (count($displayName) > 0)) { |
|
| 446 | + if ($displayName && (count($displayName) > 0)) { |
|
| 447 | 447 | $displayName = $displayName[0]; |
| 448 | 448 | |
| 449 | - if (is_array($displayName2)){ |
|
| 449 | + if (is_array($displayName2)) { |
|
| 450 | 450 | $displayName2 = count($displayName2) > 0 ? $displayName2[0] : ''; |
| 451 | 451 | } |
| 452 | 452 | |
@@ -475,7 +475,7 @@ discard block |
||
| 475 | 475 | */ |
| 476 | 476 | public function getDisplayNames($search = '', $limit = null, $offset = null) { |
| 477 | 477 | $cacheKey = 'getDisplayNames-'.$search.'-'.$limit.'-'.$offset; |
| 478 | - if(!is_null($displayNames = $this->access->connection->getFromCache($cacheKey))) { |
|
| 478 | + if (!is_null($displayNames = $this->access->connection->getFromCache($cacheKey))) { |
|
| 479 | 479 | return $displayNames; |
| 480 | 480 | } |
| 481 | 481 | |
@@ -497,12 +497,12 @@ discard block |
||
| 497 | 497 | * compared with OC_USER_BACKEND_CREATE_USER etc. |
| 498 | 498 | */ |
| 499 | 499 | public function implementsActions($actions) { |
| 500 | - return (bool)((Backend::CHECK_PASSWORD |
|
| 500 | + return (bool) ((Backend::CHECK_PASSWORD |
|
| 501 | 501 | | Backend::GET_HOME |
| 502 | 502 | | Backend::GET_DISPLAYNAME |
| 503 | 503 | | Backend::PROVIDE_AVATAR |
| 504 | 504 | | Backend::COUNT_USERS |
| 505 | - | ((intval($this->access->connection->turnOnPasswordChange) === 1)?(Backend::SET_PASSWORD):0)) |
|
| 505 | + | ((intval($this->access->connection->turnOnPasswordChange) === 1) ? (Backend::SET_PASSWORD) : 0)) |
|
| 506 | 506 | & $actions); |
| 507 | 507 | } |
| 508 | 508 | |
@@ -521,7 +521,7 @@ discard block |
||
| 521 | 521 | public function countUsers() { |
| 522 | 522 | $filter = $this->access->getFilterForUserCount(); |
| 523 | 523 | $cacheKey = 'countUsers-'.$filter; |
| 524 | - if(!is_null($entries = $this->access->connection->getFromCache($cacheKey))) { |
|
| 524 | + if (!is_null($entries = $this->access->connection->getFromCache($cacheKey))) { |
|
| 525 | 525 | return $entries; |
| 526 | 526 | } |
| 527 | 527 | $entries = $this->access->countUsers($filter); |
@@ -533,7 +533,7 @@ discard block |
||
| 533 | 533 | * Backend name to be shown in user management |
| 534 | 534 | * @return string the name of the backend to be shown |
| 535 | 535 | */ |
| 536 | - public function getBackendName(){ |
|
| 536 | + public function getBackendName() { |
|
| 537 | 537 | return 'LDAP'; |
| 538 | 538 | } |
| 539 | 539 | |