diff options
Diffstat (limited to 'lib/private/User')
-rw-r--r-- | lib/private/User/Backend.php | 4 | ||||
-rw-r--r-- | lib/private/User/Database.php | 1 | ||||
-rw-r--r-- | lib/private/User/Manager.php | 10 | ||||
-rw-r--r-- | lib/private/User/NoUserException.php | 3 | ||||
-rw-r--r-- | lib/private/User/Session.php | 17 | ||||
-rw-r--r-- | lib/private/User/User.php | 14 |
6 files changed, 21 insertions, 28 deletions
diff --git a/lib/private/User/Backend.php b/lib/private/User/Backend.php index e90cfdc2e3d..354e1c3fd71 100644 --- a/lib/private/User/Backend.php +++ b/lib/private/User/Backend.php @@ -68,8 +68,8 @@ abstract class Backend implements UserInterface { */ public function getSupportedActions() { $actions = 0; - foreach($this->possibleActions as $action => $methodName) { - if(method_exists($this, $methodName)) { + foreach ($this->possibleActions as $action => $methodName) { + if (method_exists($this, $methodName)) { $actions |= $action; } } diff --git a/lib/private/User/Database.php b/lib/private/User/Database.php index c89d3ce3690..d5098483d61 100644 --- a/lib/private/User/Database.php +++ b/lib/private/User/Database.php @@ -324,7 +324,6 @@ class Database extends ABackend } return (string)$row['uid']; } - } return false; diff --git a/lib/private/User/Manager.php b/lib/private/User/Manager.php index 1ab335eeea6..303050a7716 100644 --- a/lib/private/User/Manager.php +++ b/lib/private/User/Manager.php @@ -368,7 +368,7 @@ class Manager extends PublicEmitter implements IUserManager { $this->emit('\OC\User', 'preCreateUser', [$uid, $password]); $this->eventDispatcher->dispatchTyped(new CreateUserEvent($uid, $password)); $state = $backend->createUser($uid, $password); - if($state === false) { + if ($state === false) { throw new \InvalidArgumentException($l->t('Could not create user')); } $user = $this->getUserObject($uid, $backend); @@ -395,13 +395,13 @@ class Manager extends PublicEmitter implements IUserManager { foreach ($this->backends as $backend) { if ($backend->implementsActions(Backend::COUNT_USERS)) { $backendUsers = $backend->countUsers(); - if($backendUsers !== false) { - if($backend instanceof IUserBackend) { + if ($backendUsers !== false) { + if ($backend instanceof IUserBackend) { $name = $backend->getBackendName(); } else { $name = get_class($backend); } - if(isset($userCountStatistics[$name])) { + if (isset($userCountStatistics[$name])) { $userCountStatistics[$name] += $backendUsers; } else { $userCountStatistics[$name] = $backendUsers; @@ -421,7 +421,7 @@ class Manager extends PublicEmitter implements IUserManager { */ public function countUsersOfGroups(array $groups) { $users = []; - foreach($groups as $group) { + foreach ($groups as $group) { $usersIds = array_map(function ($user) { return $user->getUID(); }, $group->getUsers()); diff --git a/lib/private/User/NoUserException.php b/lib/private/User/NoUserException.php index 697776115be..6ae22eb1e58 100644 --- a/lib/private/User/NoUserException.php +++ b/lib/private/User/NoUserException.php @@ -23,4 +23,5 @@ namespace OC\User; -class NoUserException extends \Exception {} +class NoUserException extends \Exception { +} diff --git a/lib/private/User/Session.php b/lib/private/User/Session.php index d908a3d78b2..817dcbf4c33 100644 --- a/lib/private/User/Session.php +++ b/lib/private/User/Session.php @@ -321,9 +321,7 @@ class Session implements IUserSession, Emitter { * @return null|string */ public function getImpersonatingUserID(): ?string { - return $this->session->get('oldUserId'); - } public function setImpersonatingUserID(bool $useCurrentUser = true): void { @@ -338,7 +336,6 @@ class Session implements IUserSession, Emitter { throw new \OC\User\NoUserException(); } $this->session->set('oldUserId', $currentUser->getUID()); - } /** * set the token id @@ -384,7 +381,7 @@ class Session implements IUserSession, Emitter { throw new LoginException($message); } - if($regenerateSessionId) { + if ($regenerateSessionId) { $this->session->regenerateId(); } @@ -411,7 +408,7 @@ class Session implements IUserSession, Emitter { $loginDetails['password'], $isToken, ]); - if($this->isLoggedIn()) { + if ($this->isLoggedIn()) { $this->prepareUserLogin($firstTimeLogin, $regenerateSessionId); return true; } @@ -464,7 +461,6 @@ class Session implements IUserSession, Emitter { // Failed, maybe the user used their email address $users = $this->manager->getByEmail($user); if (!(\count($users) === 1 && $this->login($users[0]->getUID(), $password))) { - $this->logger->warning('Login failed: \'' . $user . '\' (Remote IP: \'' . \OC::$server->getRequest()->getRemoteAddress() . '\')', ['app' => 'core']); $throttler->registerAttempt('login', $request->getRemoteAddress(), ['user' => $user]); @@ -480,7 +476,7 @@ class Session implements IUserSession, Emitter { if ($isTokenPassword) { $this->session->set('app_password', $password); - } elseif($this->supportsCookies($request)) { + } elseif ($this->supportsCookies($request)) { // Password login, but cookies supported -> create (browser) session token $this->createSessionToken($request, $this->getUser()->getUID(), $user, $password); } @@ -592,7 +588,7 @@ class Session implements IUserSession, Emitter { ); // Set the last-password-confirm session to make the sudo mode work - $this->session->set('last-password-confirm', $this->timeFactory->getTime()); + $this->session->set('last-password-confirm', $this->timeFactory->getTime()); return true; } @@ -825,7 +821,7 @@ class Session implements IUserSession, Emitter { if (!$this->loginWithToken($token)) { return false; } - if(!$this->validateToken($token)) { + if (!$this->validateToken($token)) { return false; } @@ -910,7 +906,6 @@ class Session implements IUserSession, Emitter { try { $this->tokenProvider->invalidateToken($this->session->getId()); } catch (SessionNotAvailableException $ex) { - } } $this->setUser(null); @@ -1011,6 +1006,4 @@ class Session implements IUserSession, Emitter { public function updateTokens(string $uid, string $password) { $this->tokenProvider->updatePasswords($uid, $password); } - - } diff --git a/lib/private/User/User.php b/lib/private/User/User.php index 6bd86bbc516..dd451c8eb3f 100644 --- a/lib/private/User/User.php +++ b/lib/private/User/User.php @@ -87,7 +87,7 @@ class User implements IUser { $this->backend = $backend; $this->dispatcher = $dispatcher; $this->emitter = $emitter; - if(is_null($config)) { + if (is_null($config)) { $config = \OC::$server->getConfig(); } $this->config = $config; @@ -163,8 +163,8 @@ class User implements IUser { */ public function setEMailAddress($mailAddress) { $oldMailAddress = $this->getEMailAddress(); - if($oldMailAddress !== $mailAddress) { - if($mailAddress === '') { + if ($oldMailAddress !== $mailAddress) { + if ($mailAddress === '') { $this->config->deleteUserValue($this->uid, 'settings', 'email'); } else { $this->config->setUserValue($this->uid, 'settings', 'email', $mailAddress); @@ -308,7 +308,7 @@ class User implements IUser { * @return string */ public function getBackendClassName() { - if($this->backend instanceof IUserBackend) { + if ($this->backend instanceof IUserBackend) { return $this->backend->getBackendName(); } return get_class($this->backend); @@ -393,7 +393,7 @@ class User implements IUser { */ public function getQuota() { $quota = $this->config->getUserValue($this->uid, 'files', 'quota', 'default'); - if($quota === 'default') { + if ($quota === 'default') { $quota = $this->config->getAppValue('files', 'default_quota', 'none'); } return $quota; @@ -408,11 +408,11 @@ class User implements IUser { */ public function setQuota($quota) { $oldQuota = $this->config->getUserValue($this->uid, 'files', 'quota', ''); - if($quota !== 'none' and $quota !== 'default') { + if ($quota !== 'none' and $quota !== 'default') { $quota = OC_Helper::computerFileSize($quota); $quota = OC_Helper::humanFileSize($quota); } - if($quota !== $oldQuota) { + if ($quota !== $oldQuota) { $this->config->setUserValue($this->uid, 'files', 'quota', $quota); $this->triggerChange('quota', $quota, $oldQuota); } |