From 1a9330cd69631ef12b71239c4f98836e09e021ea Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Tue, 31 Mar 2020 10:49:10 +0200 Subject: Update the license headers for Nextcloud 19 Signed-off-by: Christoph Wurst --- core/Controller/AvatarController.php | 1 + core/Controller/CssController.php | 2 +- core/Controller/JsController.php | 2 +- core/Controller/LostController.php | 2 +- core/Controller/OCSController.php | 1 + core/Controller/SvgController.php | 2 +- core/Controller/UserController.php | 1 + 7 files changed, 7 insertions(+), 4 deletions(-) (limited to 'core/Controller') diff --git a/core/Controller/AvatarController.php b/core/Controller/AvatarController.php index ac07129a04f..c279edf25ad 100644 --- a/core/Controller/AvatarController.php +++ b/core/Controller/AvatarController.php @@ -2,6 +2,7 @@ /** * @copyright Copyright (c) 2016, ownCloud, Inc. * + * @author Daniel Kesselberg * @author Joas Schilling * @author John Molakvoæ (skjnldsv) * @author Lukas Reschke diff --git a/core/Controller/CssController.php b/core/Controller/CssController.php index 3e7215966bc..741d4431578 100644 --- a/core/Controller/CssController.php +++ b/core/Controller/CssController.php @@ -9,7 +9,7 @@ declare(strict_types=1); * @author John Molakvoæ (skjnldsv) * @author Morris Jobke * @author Roeland Jago Douma - * @author Thomas Citharel + * @author Thomas Citharel * * @license GNU AGPL version 3 or any later version * diff --git a/core/Controller/JsController.php b/core/Controller/JsController.php index f2accc21b45..05e7bce3368 100644 --- a/core/Controller/JsController.php +++ b/core/Controller/JsController.php @@ -9,7 +9,7 @@ declare(strict_types=1); * @author John Molakvoæ (skjnldsv) * @author Morris Jobke * @author Roeland Jago Douma - * @author Thomas Citharel + * @author Thomas Citharel * * @license GNU AGPL version 3 or any later version * diff --git a/core/Controller/LostController.php b/core/Controller/LostController.php index cdeec469e04..a210f3de547 100644 --- a/core/Controller/LostController.php +++ b/core/Controller/LostController.php @@ -5,7 +5,7 @@ * @author Arthur Schiwon * @author Bernhard Posselt * @author Bjoern Schiessle - * @author Björn Schießle + * @author Christoph Wurst * @author Daniel Kesselberg * @author Joas Schilling * @author Julius Haertl diff --git a/core/Controller/OCSController.php b/core/Controller/OCSController.php index 60ea12f017c..2ae2e0ee64e 100644 --- a/core/Controller/OCSController.php +++ b/core/Controller/OCSController.php @@ -2,6 +2,7 @@ /** * * + * @author Christoph Wurst * @author Joas Schilling * @author Julius Härtl * @author Lukas Reschke diff --git a/core/Controller/SvgController.php b/core/Controller/SvgController.php index 63105e1c0f1..ba0e77602f2 100644 --- a/core/Controller/SvgController.php +++ b/core/Controller/SvgController.php @@ -10,7 +10,7 @@ declare(strict_types=1); * @author Julius Härtl * @author Michael Weimann * @author Roeland Jago Douma - * @author Thomas Citharel + * @author Thomas Citharel * * @license GNU AGPL version 3 or any later version * diff --git a/core/Controller/UserController.php b/core/Controller/UserController.php index 54c5202a59f..2b78ba1aaea 100644 --- a/core/Controller/UserController.php +++ b/core/Controller/UserController.php @@ -2,6 +2,7 @@ /** * @copyright Copyright (c) 2016, ownCloud, Inc. * + * @author Christoph Wurst * @author Lukas Reschke * @author Morris Jobke * @author Roeland Jago Douma -- cgit v1.2.3 From 53db05a1f67fc974dba904ec158b2d67fa72df95 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Sun, 9 Feb 2020 20:06:08 +0100 Subject: Start with webauthn Signed-off-by: Roeland Jago Douma Signed-off-by: npmbuildbot[bot] --- core/Controller/LoginController.php | 9 ++- core/Controller/WebAuthnController.php | 117 +++++++++++++++++++++++++++++++++ 2 files changed, 125 insertions(+), 1 deletion(-) create mode 100644 core/Controller/WebAuthnController.php (limited to 'core/Controller') diff --git a/core/Controller/LoginController.php b/core/Controller/LoginController.php index 13aef8f67ab..b3f7bb310ba 100644 --- a/core/Controller/LoginController.php +++ b/core/Controller/LoginController.php @@ -34,6 +34,7 @@ namespace OC\Core\Controller; use OC\AppFramework\Http\Request; use OC\Authentication\Login\Chain; use OC\Authentication\Login\LoginData; +use OC\Authentication\WebAuthn\Manager as WebAuthnManager; use OC\Security\Bruteforce\Throttler; use OC\User\Session; use OC_App; @@ -80,6 +81,8 @@ class LoginController extends Controller { private $loginChain; /** @var IInitialStateService */ private $initialStateService; + /** @var WebAuthnManager */ + private $webAuthnManager; public function __construct(?string $appName, IRequest $request, @@ -92,7 +95,8 @@ class LoginController extends Controller { Defaults $defaults, Throttler $throttler, Chain $loginChain, - IInitialStateService $initialStateService) { + IInitialStateService $initialStateService, + WebAuthnManager $webAuthnManager) { parent::__construct($appName, $request); $this->userManager = $userManager; $this->config = $config; @@ -104,6 +108,7 @@ class LoginController extends Controller { $this->throttler = $throttler; $this->loginChain = $loginChain; $this->initialStateService = $initialStateService; + $this->webAuthnManager = $webAuthnManager; } /** @@ -181,6 +186,8 @@ class LoginController extends Controller { $this->setPasswordResetInitialState($user); + $this->initialStateService->provideInitialState('core', 'webauthn-available', $this->webAuthnManager->isWebAuthnAvailable()); + // OpenGraph Support: http://ogp.me/ Util::addHeader('meta', ['property' => 'og:title', 'content' => Util::sanitizeHTML($this->defaults->getName())]); Util::addHeader('meta', ['property' => 'og:description', 'content' => Util::sanitizeHTML($this->defaults->getSlogan())]); diff --git a/core/Controller/WebAuthnController.php b/core/Controller/WebAuthnController.php new file mode 100644 index 00000000000..0b98a58c1eb --- /dev/null +++ b/core/Controller/WebAuthnController.php @@ -0,0 +1,117 @@ + + * + * @author Roeland Jago Douma + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ + +namespace OC\Core\Controller; + +use OC\Authentication\Login\LoginData; +use OC\Authentication\Login\WebAuthnChain; +use OC\Authentication\WebAuthn\Manager; +use OCP\AppFramework\Controller; +use OCP\AppFramework\Http; +use OCP\AppFramework\Http\JSONResponse; +use OCP\ILogger; +use OCP\IRequest; +use OCP\ISession; +use OCP\Util; +use Webauthn\PublicKeyCredentialRequestOptions; + +class WebAuthnController extends Controller { + + private const WEBAUTHN_LOGIN = 'webauthn_login'; + private const WEBAUTHN_LOGIN_UID = 'webauthn_login_uid'; + + /** @var Manager */ + private $webAuthnManger; + + /** @var ISession */ + private $session; + + /** @var ILogger */ + private $logger; + + /** @var WebAuthnChain */ + private $webAuthnChain; + + public function __construct($appName, IRequest $request, Manager $webAuthnManger, ISession $session, ILogger $logger, WebAuthnChain $webAuthnChain) { + parent::__construct($appName, $request); + + $this->webAuthnManger = $webAuthnManger; + $this->session = $session; + $this->logger = $logger; + $this->webAuthnChain = $webAuthnChain; + } + + /** + * @NoAdminRequired + * @PublicPage + * @UseSession + */ + public function startAuthentication(string $loginName): JSONResponse { + $this->logger->debug('Starting WebAuthn login'); + + $this->logger->debug('Converting login name to UID'); + $uid = $loginName; + Util::emitHook( + '\OCA\Files_Sharing\API\Server2Server', + 'preLoginNameUsedAsUserName', + array('uid' => &$uid) + ); + $this->logger->debug('Got UID: ' . $uid); + + $publicKeyCredentialRequestOptions = $this->webAuthnManger->startAuthentication($uid, $this->request->getServerHost()); + $this->session->set(self::WEBAUTHN_LOGIN, json_encode($publicKeyCredentialRequestOptions)); + $this->session->set(self::WEBAUTHN_LOGIN_UID, $uid); + + return new JSONResponse($publicKeyCredentialRequestOptions); + } + + /** + * @NoAdminRequired + * @PublicPage + * @UseSession + */ + public function finishAuthentication(string $data): JSONResponse { + $this->logger->debug('Validating WebAuthn login'); + + if (!$this->session->exists(self::WEBAUTHN_LOGIN) || !$this->session->exists(self::WEBAUTHN_LOGIN_UID)) { + $this->logger->debug('Trying to finish WebAuthn login without session data'); + return new JSONResponse([], Http::STATUS_BAD_REQUEST); + } + + // Obtain the publicKeyCredentialOptions from when we started the registration + $publicKeyCredentialRequestOptions = PublicKeyCredentialRequestOptions::createFromString($this->session->get(self::WEBAUTHN_LOGIN)); + $uid = $this->session->get(self::WEBAUTHN_LOGIN_UID); + $this->webAuthnManger->finishAuthentication($publicKeyCredentialRequestOptions, $data, $uid); + + //TODO: add other parameters + $loginData = new LoginData( + $this->request, + $uid, + '' + ); + $this->webAuthnChain->process($loginData); + + return new JSONResponse([]); + } +} -- cgit v1.2.3 From 85e369cddb7b347cccd597ab2f65fc201632091d Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Wed, 8 Apr 2020 22:24:54 +0200 Subject: Fix multiline comments Signed-off-by: Christoph Wurst --- core/Controller/AvatarController.php | 2 +- core/Controller/WebAuthnController.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'core/Controller') diff --git a/core/Controller/AvatarController.php b/core/Controller/AvatarController.php index c279edf25ad..b5d34c3ccb9 100644 --- a/core/Controller/AvatarController.php +++ b/core/Controller/AvatarController.php @@ -259,7 +259,7 @@ class AvatarController extends Controller { /** * @NoAdminRequired - * + * * @return JSONResponse */ public function deleteAvatar() { diff --git a/core/Controller/WebAuthnController.php b/core/Controller/WebAuthnController.php index 0b98a58c1eb..4cbea8390d5 100644 --- a/core/Controller/WebAuthnController.php +++ b/core/Controller/WebAuthnController.php @@ -75,7 +75,7 @@ class WebAuthnController extends Controller { Util::emitHook( '\OCA\Files_Sharing\API\Server2Server', 'preLoginNameUsedAsUserName', - array('uid' => &$uid) + ['uid' => &$uid] ); $this->logger->debug('Got UID: ' . $uid); -- cgit v1.2.3 From 2fbad1ed72bc9ef591a6f35558eb02e7b76ffd1b Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Thu, 9 Apr 2020 09:22:29 +0200 Subject: Fix (array) indent style to always use one tab Signed-off-by: Christoph Wurst --- core/Controller/AvatarController.php | 8 ++++---- core/Controller/LostController.php | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'core/Controller') diff --git a/core/Controller/AvatarController.php b/core/Controller/AvatarController.php index b5d34c3ccb9..34280c6094f 100644 --- a/core/Controller/AvatarController.php +++ b/core/Controller/AvatarController.php @@ -282,8 +282,8 @@ class AvatarController extends Controller { $tmpAvatar = $this->cache->get('tmpAvatar'); if (is_null($tmpAvatar)) { return new JSONResponse(['data' => [ - 'message' => $this->l->t("No temporary profile picture available, try again") - ]], + 'message' => $this->l->t("No temporary profile picture available, try again") + ]], Http::STATUS_NOT_FOUND); } @@ -320,8 +320,8 @@ class AvatarController extends Controller { $tmpAvatar = $this->cache->get('tmpAvatar'); if (is_null($tmpAvatar)) { return new JSONResponse(['data' => [ - 'message' => $this->l->t("No temporary profile picture available, try again") - ]], + 'message' => $this->l->t("No temporary profile picture available, try again") + ]], Http::STATUS_BAD_REQUEST); } diff --git a/core/Controller/LostController.php b/core/Controller/LostController.php index a210f3de547..d7d9bc4c15c 100644 --- a/core/Controller/LostController.php +++ b/core/Controller/LostController.php @@ -159,8 +159,8 @@ class LostController extends Controller { public function resetform($token, $userId) { if ($this->config->getSystemValue('lost_password_link', '') !== '') { return new TemplateResponse('core', 'error', [ - 'errors' => [['error' => $this->l10n->t('Password reset is disabled')]] - ], + 'errors' => [['error' => $this->l10n->t('Password reset is disabled')]] + ], 'guest' ); } -- cgit v1.2.3 From 2a529e453a7de7f51ab72ac48f947fa9d2afd18d Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Thu, 9 Apr 2020 11:50:14 +0200 Subject: Use a blank line after the opening tag Signed-off-by: Christoph Wurst --- core/Controller/WebAuthnController.php | 1 + 1 file changed, 1 insertion(+) (limited to 'core/Controller') diff --git a/core/Controller/WebAuthnController.php b/core/Controller/WebAuthnController.php index 4cbea8390d5..1d667311ff7 100644 --- a/core/Controller/WebAuthnController.php +++ b/core/Controller/WebAuthnController.php @@ -1,4 +1,5 @@ -- cgit v1.2.3 From afbd9c4e6ed834e713039f2cff88ba3eec03dadb Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Thu, 9 Apr 2020 13:53:40 +0200 Subject: Unify function spacing to PSR2 recommendation Signed-off-by: Christoph Wurst --- core/Controller/LostController.php | 2 +- core/Controller/PreviewController.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'core/Controller') diff --git a/core/Controller/LostController.php b/core/Controller/LostController.php index d7d9bc4c15c..e3d59951d4e 100644 --- a/core/Controller/LostController.php +++ b/core/Controller/LostController.php @@ -251,7 +251,7 @@ class LostController extends Controller { * @param string $user * @return JSONResponse */ - public function email($user){ + public function email($user) { if ($this->config->getSystemValue('lost_password_link', '') !== '') { return new JSONResponse($this->error($this->l10n->t('Password reset is disabled'))); } diff --git a/core/Controller/PreviewController.php b/core/Controller/PreviewController.php index 3fd1ce2c868..b92a82028cd 100644 --- a/core/Controller/PreviewController.php +++ b/core/Controller/PreviewController.php @@ -85,7 +85,7 @@ class PreviewController extends Controller { * @param string $mode * @return DataResponse|FileDisplayResponse */ - public function getPreview ( + public function getPreview( string $file = '', int $x = 32, int $y = 32, -- cgit v1.2.3 From 36b3bc8148648eaadcc3769b1624fe1dd4c8bf93 Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Thu, 9 Apr 2020 14:04:56 +0200 Subject: Use php keywords in lowercase Signed-off-by: Christoph Wurst --- core/Controller/SetupController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'core/Controller') diff --git a/core/Controller/SetupController.php b/core/Controller/SetupController.php index 7449717831b..7df02dfea0e 100644 --- a/core/Controller/SetupController.php +++ b/core/Controller/SetupController.php @@ -70,7 +70,7 @@ class SetupController { return; } - if(isset($post['install']) AND $post['install']=='true') { + if(isset($post['install']) and $post['install']=='true') { // We have to launch the installation process : $e = $this->setupHelper->install($post); $errors = ['errors' => $e]; @@ -141,7 +141,7 @@ class SetupController { $directoryIsSet = isset($post['directory']); $adminAccountIsSet = isset($post['adminlogin']); - if ($dbIsSet AND $directoryIsSet AND $adminAccountIsSet) { + if ($dbIsSet and $directoryIsSet and $adminAccountIsSet) { $post['install'] = 'true'; } $post['dbIsSet'] = $dbIsSet; -- cgit v1.2.3 From 42625a46be495ea1c60ac8fe8e13946fd9ed9732 Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Thu, 9 Apr 2020 16:05:56 +0200 Subject: Remove spaces after method or function call Signed-off-by: Christoph Wurst --- core/Controller/SetupController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core/Controller') diff --git a/core/Controller/SetupController.php b/core/Controller/SetupController.php index 7449717831b..8205bb49201 100644 --- a/core/Controller/SetupController.php +++ b/core/Controller/SetupController.php @@ -134,7 +134,7 @@ class SetupController { \OCP\Util::writeLog('core', 'Autoconfig file found, setting up Nextcloud…', ILogger::INFO); $AUTOCONFIG = []; include $this->autoConfigFile; - $post = array_merge ($post, $AUTOCONFIG); + $post = array_merge($post, $AUTOCONFIG); } $dbIsSet = isset($post['dbtype']); -- cgit v1.2.3 From 44577e4345066952622feca9ef69c24fc23d08ab Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Thu, 9 Apr 2020 16:07:47 +0200 Subject: Remove trailing and in between spaces Signed-off-by: Christoph Wurst --- core/Controller/SetupController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'core/Controller') diff --git a/core/Controller/SetupController.php b/core/Controller/SetupController.php index 8205bb49201..f68ce9732f5 100644 --- a/core/Controller/SetupController.php +++ b/core/Controller/SetupController.php @@ -109,7 +109,7 @@ class SetupController { } private function finishSetup(bool $installRecommended) { - if( file_exists( $this->autoConfigFile )) { + if(file_exists($this->autoConfigFile)) { unlink($this->autoConfigFile); } \OC::$server->getIntegrityCodeChecker()->runInstanceVerification(); @@ -130,7 +130,7 @@ class SetupController { } public function loadAutoConfig($post) { - if( file_exists($this->autoConfigFile)) { + if(file_exists($this->autoConfigFile)) { \OCP\Util::writeLog('core', 'Autoconfig file found, setting up Nextcloud…', ILogger::INFO); $AUTOCONFIG = []; include $this->autoConfigFile; -- cgit v1.2.3 From 6c49dc2d1f602752831901a4202a87806f7e4732 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Molakvo=C3=A6=20=28skjnldsv=29?= Date: Fri, 10 Apr 2020 08:50:15 +0200 Subject: Fix absolute redirect MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ (skjnldsv) --- core/Controller/LoginController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core/Controller') diff --git a/core/Controller/LoginController.php b/core/Controller/LoginController.php index b3f7bb310ba..60fd22bd0d1 100644 --- a/core/Controller/LoginController.php +++ b/core/Controller/LoginController.php @@ -260,7 +260,7 @@ class LoginController extends Controller { private function generateRedirect(?string $redirectUrl): RedirectResponse { if ($redirectUrl !== null && $this->userSession->isLoggedIn()) { - $location = $this->urlGenerator->getAbsoluteURL(urldecode($redirectUrl)); + $location = $this->urlGenerator->getAbsoluteURL($redirectUrl); // Deny the redirect if the URL contains a @ // This prevents unvalidated redirects like ?redirect_url=:user@domain.com if (strpos($location, '@') === false) { -- cgit v1.2.3 From 14c996d98256de958da367297c3313e0fa7ef9a8 Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Fri, 10 Apr 2020 10:35:09 +0200 Subject: Use elseif instead of else if Signed-off-by: Christoph Wurst --- core/Controller/ClientFlowLoginController.php | 2 +- core/Controller/ClientFlowLoginV2Controller.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'core/Controller') diff --git a/core/Controller/ClientFlowLoginController.php b/core/Controller/ClientFlowLoginController.php index ffdfd9f9f0a..5df6ce5c7b6 100644 --- a/core/Controller/ClientFlowLoginController.php +++ b/core/Controller/ClientFlowLoginController.php @@ -385,7 +385,7 @@ class ClientFlowLoginController extends Controller { if (strpos($this->request->getRequestUri(), '/index.php') !== false) { $serverPostfix = substr($this->request->getRequestUri(), 0, strpos($this->request->getRequestUri(), '/index.php')); - } else if (strpos($this->request->getRequestUri(), '/login/flow') !== false) { + } elseif (strpos($this->request->getRequestUri(), '/login/flow') !== false) { $serverPostfix = substr($this->request->getRequestUri(), 0, strpos($this->request->getRequestUri(), '/login/flow')); } diff --git a/core/Controller/ClientFlowLoginV2Controller.php b/core/Controller/ClientFlowLoginV2Controller.php index 836606d301b..b5b69972832 100644 --- a/core/Controller/ClientFlowLoginV2Controller.php +++ b/core/Controller/ClientFlowLoginV2Controller.php @@ -291,7 +291,7 @@ class ClientFlowLoginV2Controller extends Controller { if (strpos($this->request->getRequestUri(), '/index.php') !== false) { $serverPostfix = substr($this->request->getRequestUri(), 0, strpos($this->request->getRequestUri(), '/index.php')); - } else if (strpos($this->request->getRequestUri(), '/login/v2') !== false) { + } elseif (strpos($this->request->getRequestUri(), '/login/v2') !== false) { $serverPostfix = substr($this->request->getRequestUri(), 0, strpos($this->request->getRequestUri(), '/login/v2')); } -- cgit v1.2.3 From caff1023ea72bb2ea94130e18a2a6e2ccf819e5f Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Fri, 10 Apr 2020 14:19:56 +0200 Subject: Format control structures, classes, methods and function To continue this formatting madness, here's a tiny patch that adds unified formatting for control structures like if and loops as well as classes, their methods and anonymous functions. This basically forces the constructs to start on the same line. This is not exactly what PSR2 wants, but I think we can have a few exceptions with "our" style. The starting of braces on the same line is pracrically standard for our code. This also removes and empty lines from method/function bodies at the beginning and end. Signed-off-by: Christoph Wurst --- core/Controller/AutoCompleteController.php | 2 +- core/Controller/CSRFTokenController.php | 1 - core/Controller/ClientFlowLoginController.php | 14 +++++++------- core/Controller/ClientFlowLoginV2Controller.php | 9 ++++----- core/Controller/CssController.php | 2 +- core/Controller/JsController.php | 2 +- core/Controller/LoginController.php | 1 - core/Controller/LostController.php | 8 ++++---- core/Controller/OCSController.php | 4 ++-- core/Controller/PreviewController.php | 4 ---- core/Controller/RecommendedAppsController.php | 1 - core/Controller/SetupController.php | 8 ++++---- core/Controller/TwoFactorChallengeController.php | 1 - core/Controller/UserController.php | 1 - core/Controller/WebAuthnController.php | 1 - core/Controller/WhatsNewController.php | 8 ++++---- core/Controller/WipeController.php | 1 - 17 files changed, 28 insertions(+), 40 deletions(-) (limited to 'core/Controller') diff --git a/core/Controller/AutoCompleteController.php b/core/Controller/AutoCompleteController.php index 12414b50f30..31d0a7ab7b3 100644 --- a/core/Controller/AutoCompleteController.php +++ b/core/Controller/AutoCompleteController.php @@ -91,7 +91,7 @@ class AutoCompleteController extends Controller { unset($results['exact']); $results = array_merge_recursive($exactMatches, $results); - if($sorter !== null) { + if ($sorter !== null) { $sorters = array_reverse(explode('|', $sorter)); $this->autoCompleteManager->runSorters($sorters, $results, [ 'itemType' => $itemType, diff --git a/core/Controller/CSRFTokenController.php b/core/Controller/CSRFTokenController.php index b120acbcd5f..9ff389140bd 100644 --- a/core/Controller/CSRFTokenController.php +++ b/core/Controller/CSRFTokenController.php @@ -66,5 +66,4 @@ class CSRFTokenController extends Controller { 'token' => $requestToken->getEncryptedValue(), ]); } - } diff --git a/core/Controller/ClientFlowLoginController.php b/core/Controller/ClientFlowLoginController.php index 5df6ce5c7b6..dad43fc837a 100644 --- a/core/Controller/ClientFlowLoginController.php +++ b/core/Controller/ClientFlowLoginController.php @@ -135,7 +135,7 @@ class ClientFlowLoginController extends Controller { */ private function isValidToken($stateToken) { $currentToken = $this->session->get(self::stateName); - if(!is_string($stateToken) || !is_string($currentToken)) { + if (!is_string($stateToken) || !is_string($currentToken)) { return false; } return hash_equals($currentToken, $stateToken); @@ -169,7 +169,7 @@ class ClientFlowLoginController extends Controller { public function showAuthPickerPage($clientIdentifier = '') { $clientName = $this->getClientName(); $client = null; - if($clientIdentifier !== '') { + if ($clientIdentifier !== '') { $client = $this->clientMapper->getByIdentifier($clientIdentifier); $clientName = $client->getName(); } @@ -237,13 +237,13 @@ class ClientFlowLoginController extends Controller { */ public function grantPage($stateToken = '', $clientIdentifier = '') { - if(!$this->isValidToken($stateToken)) { + if (!$this->isValidToken($stateToken)) { return $this->stateTokenForbiddenResponse(); } $clientName = $this->getClientName(); $client = null; - if($clientIdentifier !== '') { + if ($clientIdentifier !== '') { $client = $this->clientMapper->getByIdentifier($clientIdentifier); $clientName = $client->getName(); } @@ -284,7 +284,7 @@ class ClientFlowLoginController extends Controller { */ public function generateAppPassword($stateToken, $clientIdentifier = '') { - if(!$this->isValidToken($stateToken)) { + if (!$this->isValidToken($stateToken)) { $this->session->remove(self::stateName); return $this->stateTokenForbiddenResponse(); } @@ -315,7 +315,7 @@ class ClientFlowLoginController extends Controller { $clientName = $this->getClientName(); $client = false; - if($clientIdentifier !== '') { + if ($clientIdentifier !== '') { $client = $this->clientMapper->getByIdentifier($clientIdentifier); $clientName = $client->getName(); } @@ -332,7 +332,7 @@ class ClientFlowLoginController extends Controller { IToken::DO_NOT_REMEMBER ); - if($client) { + if ($client) { $code = $this->random->generate(128, ISecureRandom::CHAR_UPPER.ISecureRandom::CHAR_LOWER.ISecureRandom::CHAR_DIGITS); $accessToken = new AccessToken(); $accessToken->setClientId($client->getId()); diff --git a/core/Controller/ClientFlowLoginV2Controller.php b/core/Controller/ClientFlowLoginV2Controller.php index b5b69972832..43e17c77dde 100644 --- a/core/Controller/ClientFlowLoginV2Controller.php +++ b/core/Controller/ClientFlowLoginV2Controller.php @@ -43,7 +43,6 @@ use OCP\IURLGenerator; use OCP\Security\ISecureRandom; class ClientFlowLoginV2Controller extends Controller { - private const tokenName = 'client.flow.v2.login.token'; private const stateName = 'client.flow.v2.state.token'; @@ -150,7 +149,7 @@ class ClientFlowLoginV2Controller extends Controller { * @NoSameSiteCookieRequired */ public function grantPage(string $stateToken): StandaloneTemplateResponse { - if(!$this->isValidStateToken($stateToken)) { + if (!$this->isValidStateToken($stateToken)) { return $this->stateTokenForbiddenResponse(); } @@ -178,7 +177,7 @@ class ClientFlowLoginV2Controller extends Controller { * @UseSession */ public function generateAppPassword(string $stateToken): Response { - if(!$this->isValidStateToken($stateToken)) { + if (!$this->isValidStateToken($stateToken)) { return $this->stateTokenForbiddenResponse(); } @@ -241,7 +240,7 @@ class ClientFlowLoginV2Controller extends Controller { private function isValidStateToken(string $stateToken): bool { $currentToken = $this->session->get(self::stateName); - if(!is_string($stateToken) || !is_string($currentToken)) { + if (!is_string($stateToken) || !is_string($currentToken)) { return false; } return hash_equals($currentToken, $stateToken); @@ -266,7 +265,7 @@ class ClientFlowLoginV2Controller extends Controller { */ private function getFlowByLoginToken(): LoginFlowV2 { $currentToken = $this->session->get(self::tokenName); - if(!is_string($currentToken)) { + if (!is_string($currentToken)) { throw new LoginFlowV2NotFoundException('Login token not set in session'); } diff --git a/core/Controller/CssController.php b/core/Controller/CssController.php index 741d4431578..f7368003d55 100644 --- a/core/Controller/CssController.php +++ b/core/Controller/CssController.php @@ -75,7 +75,7 @@ class CssController extends Controller { $folder = $this->appData->getFolder($appName); $gzip = false; $file = $this->getFile($folder, $fileName, $gzip); - } catch(NotFoundException $e) { + } catch (NotFoundException $e) { return new NotFoundResponse(); } diff --git a/core/Controller/JsController.php b/core/Controller/JsController.php index 05e7bce3368..730a1cf0cb8 100644 --- a/core/Controller/JsController.php +++ b/core/Controller/JsController.php @@ -72,7 +72,7 @@ class JsController extends Controller { $folder = $this->appData->getFolder($appName); $gzip = false; $file = $this->getFile($folder, $fileName, $gzip); - } catch(NotFoundException $e) { + } catch (NotFoundException $e) { return new NotFoundResponse(); } diff --git a/core/Controller/LoginController.php b/core/Controller/LoginController.php index b3f7bb310ba..4813f15f1c5 100644 --- a/core/Controller/LoginController.php +++ b/core/Controller/LoginController.php @@ -57,7 +57,6 @@ use OCP\IUserSession; use OCP\Util; class LoginController extends Controller { - const LOGIN_MSG_INVALIDPASSWORD = 'invalidpassword'; const LOGIN_MSG_USERDISABLED = 'userdisabled'; diff --git a/core/Controller/LostController.php b/core/Controller/LostController.php index e3d59951d4e..0a2e8d6b73d 100644 --- a/core/Controller/LostController.php +++ b/core/Controller/LostController.php @@ -195,7 +195,7 @@ class LostController extends Controller { */ protected function checkPasswordResetToken($token, $userId) { $user = $this->userManager->get($userId); - if($user === null || !$user->isEnabled()) { + if ($user === null || !$user->isEnabled()) { throw new \Exception($this->l10n->t('Couldn\'t reset password because the token is invalid')); } @@ -212,7 +212,7 @@ class LostController extends Controller { } $splittedToken = explode(':', $decryptedToken); - if(count($splittedToken) !== 2) { + if (count($splittedToken) !== 2) { throw new \Exception($this->l10n->t('Couldn\'t reset password because the token is invalid')); } @@ -318,9 +318,9 @@ class LostController extends Controller { $this->config->deleteUserValue($userId, 'core', 'lostpassword'); @\OC::$server->getUserSession()->unsetMagicInCookie(); - } catch (HintException $e){ + } catch (HintException $e) { return $this->error($e->getHint()); - } catch (\Exception $e){ + } catch (\Exception $e) { return $this->error($e->getMessage()); } diff --git a/core/Controller/OCSController.php b/core/Controller/OCSController.php index 2ae2e0ee64e..7ed43fc6003 100644 --- a/core/Controller/OCSController.php +++ b/core/Controller/OCSController.php @@ -102,7 +102,7 @@ class OCSController extends \OCP\AppFramework\OCSController { 'extendedSupport' => \OCP\Util::hasExtendedSupport() ]; - if($this->userSession->isLoggedIn()) { + if ($this->userSession->isLoggedIn()) { $result['capabilities'] = $this->capabilitiesManager->getCapabilities(); } else { $result['capabilities'] = $this->capabilitiesManager->getCapabilities(true); @@ -145,7 +145,7 @@ class OCSController extends \OCP\AppFramework\OCSController { public function getIdentityProof($cloudId) { $userObject = $this->userManager->get($cloudId); - if($userObject !== null) { + if ($userObject !== null) { $key = $this->keyManager->getKey($userObject); $data = [ 'public' => $key->getPublic(), diff --git a/core/Controller/PreviewController.php b/core/Controller/PreviewController.php index b92a82028cd..f47104bc533 100644 --- a/core/Controller/PreviewController.php +++ b/core/Controller/PreviewController.php @@ -92,7 +92,6 @@ class PreviewController extends Controller { bool $a = false, bool $forceIcon = true, string $mode = 'fill'): Http\Response { - if ($file === '' || $x === 0 || $y === 0) { return new DataResponse([], Http::STATUS_BAD_REQUEST); } @@ -127,7 +126,6 @@ class PreviewController extends Controller { bool $a = false, bool $forceIcon = true, string $mode = 'fill') { - if ($fileId === -1 || $x === 0 || $y === 0) { return new DataResponse([], Http::STATUS_BAD_REQUEST); } @@ -160,7 +158,6 @@ class PreviewController extends Controller { bool $a = false, bool $forceIcon = true, string $mode) : Http\Response { - if (!($node instanceof File) || (!$forceIcon && !$this->preview->isAvailable($node))) { return new DataResponse([], Http::STATUS_NOT_FOUND); } @@ -178,6 +175,5 @@ class PreviewController extends Controller { } catch (\InvalidArgumentException $e) { return new DataResponse([], Http::STATUS_BAD_REQUEST); } - } } diff --git a/core/Controller/RecommendedAppsController.php b/core/Controller/RecommendedAppsController.php index fe3435d9be8..6240aecf43c 100644 --- a/core/Controller/RecommendedAppsController.php +++ b/core/Controller/RecommendedAppsController.php @@ -51,5 +51,4 @@ class RecommendedAppsController extends Controller { $this->initialStateService->provideInitialState('core', 'defaultPageUrl', \OC_Util::getDefaultPageUrl()); return new StandaloneTemplateResponse($this->appName, 'recommendedapps', [], 'guest'); } - } diff --git a/core/Controller/SetupController.php b/core/Controller/SetupController.php index d77f6982f3d..b57b991884c 100644 --- a/core/Controller/SetupController.php +++ b/core/Controller/SetupController.php @@ -70,12 +70,12 @@ class SetupController { return; } - if(isset($post['install']) and $post['install']=='true') { + if (isset($post['install']) and $post['install']=='true') { // We have to launch the installation process : $e = $this->setupHelper->install($post); $errors = ['errors' => $e]; - if(count($e) > 0) { + if (count($e) > 0) { $options = array_merge($opts, $post, $errors); $this->display($options); } else { @@ -109,7 +109,7 @@ class SetupController { } private function finishSetup(bool $installRecommended) { - if(file_exists($this->autoConfigFile)) { + if (file_exists($this->autoConfigFile)) { unlink($this->autoConfigFile); } \OC::$server->getIntegrityCodeChecker()->runInstanceVerification(); @@ -130,7 +130,7 @@ class SetupController { } public function loadAutoConfig($post) { - if(file_exists($this->autoConfigFile)) { + if (file_exists($this->autoConfigFile)) { \OCP\Util::writeLog('core', 'Autoconfig file found, setting up Nextcloud…', ILogger::INFO); $AUTOCONFIG = []; include $this->autoConfigFile; diff --git a/core/Controller/TwoFactorChallengeController.php b/core/Controller/TwoFactorChallengeController.php index 4209e48e648..251ae85b3f7 100644 --- a/core/Controller/TwoFactorChallengeController.php +++ b/core/Controller/TwoFactorChallengeController.php @@ -278,5 +278,4 @@ class TwoFactorChallengeController extends Controller { ] )); } - } diff --git a/core/Controller/UserController.php b/core/Controller/UserController.php index 2b78ba1aaea..638e4e00e46 100644 --- a/core/Controller/UserController.php +++ b/core/Controller/UserController.php @@ -71,6 +71,5 @@ class UserController extends Controller { ]; return new JSONResponse($json); - } } diff --git a/core/Controller/WebAuthnController.php b/core/Controller/WebAuthnController.php index 1d667311ff7..7315053f12d 100644 --- a/core/Controller/WebAuthnController.php +++ b/core/Controller/WebAuthnController.php @@ -38,7 +38,6 @@ use OCP\Util; use Webauthn\PublicKeyCredentialRequestOptions; class WebAuthnController extends Controller { - private const WEBAUTHN_LOGIN = 'webauthn_login'; private const WEBAUTHN_LOGIN_UID = 'webauthn_login_uid'; diff --git a/core/Controller/WhatsNewController.php b/core/Controller/WhatsNewController.php index 159e88e1474..3a72486b26a 100644 --- a/core/Controller/WhatsNewController.php +++ b/core/Controller/WhatsNewController.php @@ -74,13 +74,13 @@ class WhatsNewController extends OCSController { */ public function get():DataResponse { $user = $this->userSession->getUser(); - if($user === null) { + if ($user === null) { throw new \RuntimeException("Acting user cannot be resolved"); } $lastRead = $this->config->getUserValue($user->getUID(), 'core', 'whatsNewLastRead', 0); $currentVersion = $this->whatsNewService->normalizeVersion($this->config->getSystemValue('version')); - if(version_compare($lastRead, $currentVersion, '>=')) { + if (version_compare($lastRead, $currentVersion, '>=')) { return new DataResponse([], Http::STATUS_NO_CONTENT); } @@ -94,7 +94,7 @@ class WhatsNewController extends OCSController { ]; do { $lang = $iterator->current(); - if(isset($whatsNew['whatsNew'][$lang])) { + if (isset($whatsNew['whatsNew'][$lang])) { $resultData['whatsNew'] = $whatsNew['whatsNew'][$lang]; break; } @@ -114,7 +114,7 @@ class WhatsNewController extends OCSController { */ public function dismiss(string $version):DataResponse { $user = $this->userSession->getUser(); - if($user === null) { + if ($user === null) { throw new \RuntimeException("Acting user cannot be resolved"); } $version = $this->whatsNewService->normalizeVersion($version); diff --git a/core/Controller/WipeController.php b/core/Controller/WipeController.php index 378fb112850..bc3cc7ba063 100644 --- a/core/Controller/WipeController.php +++ b/core/Controller/WipeController.php @@ -94,5 +94,4 @@ class WipeController extends Controller { return new JSONResponse([], Http::STATUS_NOT_FOUND); } } - } -- cgit v1.2.3 From 28f8eb5dba60a75f7e22debbdc26f1d3164deb18 Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Fri, 10 Apr 2020 16:54:27 +0200 Subject: Add visibility to all constants Signed-off-by: Christoph Wurst --- core/Controller/ClientFlowLoginController.php | 2 +- core/Controller/LoginController.php | 4 ++-- core/Controller/SetupController.php | 2 +- core/Controller/WalledGardenController.php | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'core/Controller') diff --git a/core/Controller/ClientFlowLoginController.php b/core/Controller/ClientFlowLoginController.php index dad43fc837a..748a4cf50d2 100644 --- a/core/Controller/ClientFlowLoginController.php +++ b/core/Controller/ClientFlowLoginController.php @@ -77,7 +77,7 @@ class ClientFlowLoginController extends Controller { /** @var EventDispatcherInterface */ private $eventDispatcher; - const stateName = 'client.flow.state.token'; + public const stateName = 'client.flow.state.token'; /** * @param string $appName diff --git a/core/Controller/LoginController.php b/core/Controller/LoginController.php index 4813f15f1c5..0fcadd21c8a 100644 --- a/core/Controller/LoginController.php +++ b/core/Controller/LoginController.php @@ -57,8 +57,8 @@ use OCP\IUserSession; use OCP\Util; class LoginController extends Controller { - const LOGIN_MSG_INVALIDPASSWORD = 'invalidpassword'; - const LOGIN_MSG_USERDISABLED = 'userdisabled'; + public const LOGIN_MSG_INVALIDPASSWORD = 'invalidpassword'; + public const LOGIN_MSG_USERDISABLED = 'userdisabled'; /** @var IUserManager */ private $userManager; diff --git a/core/Controller/SetupController.php b/core/Controller/SetupController.php index b57b991884c..dd7e4eefc81 100644 --- a/core/Controller/SetupController.php +++ b/core/Controller/SetupController.php @@ -44,7 +44,7 @@ class SetupController { /** * @param Setup $setupHelper */ - function __construct(Setup $setupHelper) { + public function __construct(Setup $setupHelper) { $this->autoConfigFile = \OC::$configDir.'autoconfig.php'; $this->setupHelper = $setupHelper; } diff --git a/core/Controller/WalledGardenController.php b/core/Controller/WalledGardenController.php index 5bd66225076..fd2b3cbf902 100644 --- a/core/Controller/WalledGardenController.php +++ b/core/Controller/WalledGardenController.php @@ -35,7 +35,7 @@ class WalledGardenController extends Controller { * * @return Response */ - function get() { + public function get() { $resp = new Response(); $resp->setStatus(Http::STATUS_NO_CONTENT); return $resp; -- cgit v1.2.3 From 72a16b17792e2a5353cc0ffce8fc24ed4ff1351c Mon Sep 17 00:00:00 2001 From: Daniel Kesselberg Date: Wed, 22 Jan 2020 21:13:36 +0100 Subject: Make it possible to resolve svg for apps_paths outside the document root Previous implementation assumes the app path is always a child \OC::$SERVERROOT. That's not always true. Signed-off-by: Daniel Kesselberg --- core/Controller/SvgController.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'core/Controller') diff --git a/core/Controller/SvgController.php b/core/Controller/SvgController.php index ba0e77602f2..af71ca17330 100644 --- a/core/Controller/SvgController.php +++ b/core/Controller/SvgController.php @@ -32,6 +32,7 @@ declare(strict_types=1); namespace OC\Core\Controller; use OC\Template\IconsCacher; +use OCP\App\AppPathNotFoundException; use OCP\App\IAppManager; use OCP\AppFramework\Controller; use OCP\AppFramework\Http; @@ -97,13 +98,13 @@ class SvgController extends Controller { * @return DataDisplayResponse|NotFoundResponse */ public function getSvgFromApp(string $app, string $fileName, string $color = 'ffffff') { - $appRootPath = $this->appManager->getAppPath($app); - $appPath = substr($appRootPath, strlen($this->serverRoot)); - - if (!$appPath) { + try { + $appPath = $this->appManager->getAppPath($app); + } catch (AppPathNotFoundException $e) { return new NotFoundResponse(); } - $path = $this->serverRoot . $appPath ."/img/$fileName.svg"; + + $path = $appPath . "/img/$fileName.svg"; return $this->getSvg($path, $color, $fileName); } -- cgit v1.2.3 From 25dfaefd0192ccf887056f2ffd066c1d5fdbbf4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Molakvo=C3=A6=20=28skjnldsv=29?= Date: Mon, 27 Apr 2020 08:40:54 +0200 Subject: Fix missing argument in JSConfigHelper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ (skjnldsv) --- core/Controller/OCJSController.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'core/Controller') diff --git a/core/Controller/OCJSController.php b/core/Controller/OCJSController.php index 617f6b25236..29a210a092d 100644 --- a/core/Controller/OCJSController.php +++ b/core/Controller/OCJSController.php @@ -37,6 +37,7 @@ use OCP\AppFramework\Http\DataDisplayResponse; use OCP\Defaults; use OCP\IConfig; use OCP\IGroupManager; +use OCP\IInitialStateService; use OCP\IRequest; use OCP\ISession; use OCP\IURLGenerator; @@ -63,6 +64,7 @@ class OCJSController extends Controller { * @param IniGetWrapper $iniWrapper * @param IURLGenerator $urlGenerator * @param CapabilitiesManager $capabilitiesManager + * @param IInitialStateService $initialStateService */ public function __construct($appName, IRequest $request, @@ -75,7 +77,8 @@ class OCJSController extends Controller { IGroupManager $groupManager, IniGetWrapper $iniWrapper, IURLGenerator $urlGenerator, - CapabilitiesManager $capabilitiesManager) { + CapabilitiesManager $capabilitiesManager, + IInitialStateService $initialStateService) { parent::__construct($appName, $request); $this->helper = new JSConfigHelper( @@ -88,7 +91,8 @@ class OCJSController extends Controller { $groupManager, $iniWrapper, $urlGenerator, - $capabilitiesManager + $capabilitiesManager, + $initialStateService, ); } -- cgit v1.2.3 From cb057829f72c70e819f456edfadbb29d72dba832 Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Wed, 29 Apr 2020 11:57:22 +0200 Subject: Update license headers for 19 Signed-off-by: Christoph Wurst --- core/Controller/AutoCompleteController.php | 1 + core/Controller/AvatarController.php | 1 + core/Controller/ClientFlowLoginController.php | 1 + core/Controller/ClientFlowLoginV2Controller.php | 1 + core/Controller/CssController.php | 1 + core/Controller/JsController.php | 1 + core/Controller/LoginController.php | 1 + core/Controller/OCJSController.php | 1 + core/Controller/PreviewController.php | 1 + core/Controller/SvgController.php | 2 +- core/Controller/WalledGardenController.php | 1 + core/Controller/WebAuthnController.php | 4 +++- core/Controller/WhatsNewController.php | 1 + 13 files changed, 15 insertions(+), 2 deletions(-) (limited to 'core/Controller') diff --git a/core/Controller/AutoCompleteController.php b/core/Controller/AutoCompleteController.php index 31d0a7ab7b3..0eebaabafd6 100644 --- a/core/Controller/AutoCompleteController.php +++ b/core/Controller/AutoCompleteController.php @@ -6,6 +6,7 @@ declare(strict_types=1); * @copyright Copyright (c) 2017 Arthur Schiwon * * @author Arthur Schiwon + * @author Christoph Wurst * @author Joas Schilling * @author Roeland Jago Douma * diff --git a/core/Controller/AvatarController.php b/core/Controller/AvatarController.php index 34280c6094f..ac0f9535dca 100644 --- a/core/Controller/AvatarController.php +++ b/core/Controller/AvatarController.php @@ -2,6 +2,7 @@ /** * @copyright Copyright (c) 2016, ownCloud, Inc. * + * @author Christoph Wurst * @author Daniel Kesselberg * @author Joas Schilling * @author John Molakvoæ (skjnldsv) diff --git a/core/Controller/ClientFlowLoginController.php b/core/Controller/ClientFlowLoginController.php index 748a4cf50d2..d5beded9581 100644 --- a/core/Controller/ClientFlowLoginController.php +++ b/core/Controller/ClientFlowLoginController.php @@ -3,6 +3,7 @@ * @copyright Copyright (c) 2017 Lukas Reschke * * @author Bjoern Schiessle + * @author Christoph Wurst * @author Daniel Kesselberg * @author Lukas Reschke * @author Mario Danic diff --git a/core/Controller/ClientFlowLoginV2Controller.php b/core/Controller/ClientFlowLoginV2Controller.php index 43e17c77dde..d5b50dd413c 100644 --- a/core/Controller/ClientFlowLoginV2Controller.php +++ b/core/Controller/ClientFlowLoginV2Controller.php @@ -5,6 +5,7 @@ declare(strict_types=1); /** * @copyright Copyright (c) 2019, Roeland Jago Douma * + * @author Christoph Wurst * @author Roeland Jago Douma * * @license GNU AGPL version 3 or any later version diff --git a/core/Controller/CssController.php b/core/Controller/CssController.php index f7368003d55..05c1bd5e6cf 100644 --- a/core/Controller/CssController.php +++ b/core/Controller/CssController.php @@ -5,6 +5,7 @@ declare(strict_types=1); /** * @copyright Copyright (c) 2016, John Molakvoæ (skjnldsv@protonmail.com) * + * @author Christoph Wurst * @author Joas Schilling * @author John Molakvoæ (skjnldsv) * @author Morris Jobke diff --git a/core/Controller/JsController.php b/core/Controller/JsController.php index 730a1cf0cb8..2adb0ac374d 100644 --- a/core/Controller/JsController.php +++ b/core/Controller/JsController.php @@ -5,6 +5,7 @@ declare(strict_types=1); /** * @copyright 2017, Roeland Jago Douma * + * @author Christoph Wurst * @author Joas Schilling * @author John Molakvoæ (skjnldsv) * @author Morris Jobke diff --git a/core/Controller/LoginController.php b/core/Controller/LoginController.php index a2828599251..7073584a66b 100644 --- a/core/Controller/LoginController.php +++ b/core/Controller/LoginController.php @@ -7,6 +7,7 @@ * @author Christoph Wurst * @author Daniel Kesselberg * @author Joas Schilling + * @author John Molakvoæ (skjnldsv) * @author Julius Härtl * @author Lukas Reschke * @author Michael Weimann diff --git a/core/Controller/OCJSController.php b/core/Controller/OCJSController.php index 29a210a092d..2a377e56f66 100644 --- a/core/Controller/OCJSController.php +++ b/core/Controller/OCJSController.php @@ -4,6 +4,7 @@ * * @author Bjoern Schiessle * @author Joas Schilling + * @author John Molakvoæ (skjnldsv) * @author Lukas Reschke * @author Morris Jobke * @author Roeland Jago Douma diff --git a/core/Controller/PreviewController.php b/core/Controller/PreviewController.php index f47104bc533..0b762094086 100644 --- a/core/Controller/PreviewController.php +++ b/core/Controller/PreviewController.php @@ -5,6 +5,7 @@ declare(strict_types=1); /** * @copyright Copyright (c) 2016, Roeland Jago Douma * + * @author Christoph Wurst * @author Morris Jobke * @author Roeland Jago Douma * diff --git a/core/Controller/SvgController.php b/core/Controller/SvgController.php index af71ca17330..573f245c5a1 100644 --- a/core/Controller/SvgController.php +++ b/core/Controller/SvgController.php @@ -5,10 +5,10 @@ declare(strict_types=1); /** * @copyright Copyright (c) 2018, John Molakvoæ (skjnldsv@protonmail.com) * + * @author Daniel Kesselberg * @author Joas Schilling * @author John Molakvoæ (skjnldsv) * @author Julius Härtl - * @author Michael Weimann * @author Roeland Jago Douma * @author Thomas Citharel * diff --git a/core/Controller/WalledGardenController.php b/core/Controller/WalledGardenController.php index fd2b3cbf902..208162c754e 100644 --- a/core/Controller/WalledGardenController.php +++ b/core/Controller/WalledGardenController.php @@ -2,6 +2,7 @@ /** * @copyright 2017, Roeland Jago Douma * + * @author Christoph Wurst * @author Roeland Jago Douma * * @license GNU AGPL version 3 or any later version diff --git a/core/Controller/WebAuthnController.php b/core/Controller/WebAuthnController.php index 7315053f12d..b602fe4c728 100644 --- a/core/Controller/WebAuthnController.php +++ b/core/Controller/WebAuthnController.php @@ -1,9 +1,11 @@ * + * @author Christoph Wurst * @author Roeland Jago Douma * * @license GNU AGPL version 3 or any later version @@ -19,7 +21,7 @@ declare(strict_types=1); * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * along with this program. If not, see . * */ diff --git a/core/Controller/WhatsNewController.php b/core/Controller/WhatsNewController.php index 3a72486b26a..48cd26a1b59 100644 --- a/core/Controller/WhatsNewController.php +++ b/core/Controller/WhatsNewController.php @@ -3,6 +3,7 @@ * @copyright Copyright (c) 2018 Arthur Schiwon * * @author Arthur Schiwon + * @author Christoph Wurst * * @license GNU AGPL version 3 or any later version * -- cgit v1.2.3 From df669a29360a3ec69e87829f15571f261b39280b Mon Sep 17 00:00:00 2001 From: Daniel Kesselberg Date: Wed, 29 Apr 2020 15:16:53 +0200 Subject: Set etag for capabilities endpoint Signed-off-by: Daniel Kesselberg --- core/Controller/OCSController.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'core/Controller') diff --git a/core/Controller/OCSController.php b/core/Controller/OCSController.php index 7ed43fc6003..057dee78676 100644 --- a/core/Controller/OCSController.php +++ b/core/Controller/OCSController.php @@ -108,7 +108,9 @@ class OCSController extends \OCP\AppFramework\OCSController { $result['capabilities'] = $this->capabilitiesManager->getCapabilities(true); } - return new DataResponse($result); + $response = new DataResponse($result); + $response->setETag(md5(json_encode($result))); + return $response; } /** -- cgit v1.2.3 From ffad3f83fe97a6eb9943de4e004e49ac1590d2e4 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Thu, 7 May 2020 16:32:28 +0200 Subject: Validate app password on alternative login Fixes #20838 Signed-off-by: Roeland Jago Douma --- core/Controller/ClientFlowLoginController.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'core/Controller') diff --git a/core/Controller/ClientFlowLoginController.php b/core/Controller/ClientFlowLoginController.php index d5beded9581..80cf94a7900 100644 --- a/core/Controller/ClientFlowLoginController.php +++ b/core/Controller/ClientFlowLoginController.php @@ -377,6 +377,24 @@ class ClientFlowLoginController extends Controller { return $this->stateTokenForbiddenResponse(); } + try { + $token = $this->tokenProvider->getToken($password); + if ($token->getLoginName() !== $user) { + throw new InvalidTokenException('login name does not match'); + } + } catch (InvalidTokenException $e) { + $response = new StandaloneTemplateResponse( + $this->appName, + '403', + [ + 'message' => $this->l10n->t('Invalid app password'), + ], + 'guest' + ); + $response->setStatus(Http::STATUS_FORBIDDEN); + return $response; + } + $redirectUri = 'nc://login/server:' . $this->getServerPath() . '&user:' . urlencode($user) . '&password:' . urlencode($password); return new Http\RedirectResponse($redirectUri); } -- cgit v1.2.3 From 4a2a6b65f33e35f1629af8fb1709c1c1a8ccacd2 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Tue, 12 May 2020 14:52:55 +0200 Subject: Cache the avatar for a day I noticed that on larger systems esp when using talk the avatars get revalidated like crazy. Because people keep the tab open etc. You can do with a slightly outdated avatar! Signed-off-by: Roeland Jago Douma --- core/Controller/AvatarController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'core/Controller') diff --git a/core/Controller/AvatarController.php b/core/Controller/AvatarController.php index ac0f9535dca..dc6febc467f 100644 --- a/core/Controller/AvatarController.php +++ b/core/Controller/AvatarController.php @@ -153,8 +153,8 @@ class AvatarController extends Controller { return new JSONResponse([], Http::STATUS_NOT_FOUND); } - // Cache for 30 minutes - $response->cacheFor(1800); + // Cache for 1 day + $response->cacheFor(60*60*24); return $response; } -- cgit v1.2.3 From e1be52b97b65b55b96dd746ec75b83e0d7e0c1c7 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Wed, 13 May 2020 11:20:54 +0200 Subject: Trailing comma's in functin arguments break on 7.2 Signed-off-by: Roeland Jago Douma --- core/Controller/OCJSController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core/Controller') diff --git a/core/Controller/OCJSController.php b/core/Controller/OCJSController.php index 2a377e56f66..c3a74733b98 100644 --- a/core/Controller/OCJSController.php +++ b/core/Controller/OCJSController.php @@ -93,7 +93,7 @@ class OCJSController extends Controller { $iniWrapper, $urlGenerator, $capabilitiesManager, - $initialStateService, + $initialStateService ); } -- cgit v1.2.3 From fda55db4c97df9e8973645ed3164457a426a5a23 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Tue, 16 Jun 2020 15:22:36 +0200 Subject: Filter out search results that have invalid encoding this prevents a single invalid search results from erroring the entire search request Signed-off-by: Robin Appelman --- core/Controller/SearchController.php | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'core/Controller') diff --git a/core/Controller/SearchController.php b/core/Controller/SearchController.php index 8d3a6f623b7..a24aa7fa1ec 100644 --- a/core/Controller/SearchController.php +++ b/core/Controller/SearchController.php @@ -28,20 +28,28 @@ namespace OC\Core\Controller; use OCP\AppFramework\Controller; use OCP\AppFramework\Http\JSONResponse; +use OCP\ILogger; use OCP\IRequest; use OCP\ISearch; +use OCP\Search\Result; class SearchController extends Controller { /** @var ISearch */ private $searcher; + /** @var ILogger */ + private $logger; - public function __construct(string $appName, - IRequest $request, - ISearch $search) { + public function __construct( + string $appName, + IRequest $request, + ISearch $search, + ILogger $logger + ) { parent::__construct($appName, $request); $this->searcher = $search; + $this->logger = $logger; } /** @@ -50,6 +58,15 @@ class SearchController extends Controller { public function search(string $query, array $inApps = [], int $page = 1, int $size = 30): JSONResponse { $results = $this->searcher->searchPaged($query, $inApps, $page, $size); + $results = array_filter($results, function (Result $result) { + if (json_encode($result, JSON_HEX_TAG) === false) { + $this->logger->warning("Skipping search result due to invalid encoding: {type: " . $result->type . ", id: " . $result->id . "}"); + return false; + } else { + return true; + } + }); + return new JSONResponse($results); } } -- cgit v1.2.3 From 4488e846a526ed8de37e9756621b7c008d7a9466 Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Mon, 11 May 2020 10:35:54 +0200 Subject: Add unified search API Signed-off-by: Christoph Wurst --- core/Controller/UnifiedSearchController.php | 98 +++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 core/Controller/UnifiedSearchController.php (limited to 'core/Controller') diff --git a/core/Controller/UnifiedSearchController.php b/core/Controller/UnifiedSearchController.php new file mode 100644 index 00000000000..ddb1745dea5 --- /dev/null +++ b/core/Controller/UnifiedSearchController.php @@ -0,0 +1,98 @@ + + * + * @author 2020 Christoph Wurst + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +namespace OC\Core\Controller; + +use OC\Search\SearchComposer; +use OC\Search\SearchQuery; +use OCP\AppFramework\Controller; +use OCP\AppFramework\Http; +use OCP\AppFramework\Http\JSONResponse; +use OCP\IRequest; +use OCP\IUserSession; +use OCP\Search\ISearchQuery; + +class UnifiedSearchController extends Controller { + + /** @var SearchComposer */ + private $composer; + + /** @var IUserSession */ + private $userSession; + + public function __construct(IRequest $request, + IUserSession $userSession, + SearchComposer $composer) { + parent::__construct('core', $request); + + $this->composer = $composer; + $this->userSession = $userSession; + } + + /** + * @NoAdminRequired + * @NoCSRFRequired + */ + public function getProviders(): JSONResponse { + return new JSONResponse( + $this->composer->getProviders() + ); + } + + /** + * @NoAdminRequired + * @NoCSRFRequired + * + * @param string $providerId + * @param string $term + * @param int|null $sortOrder + * @param int|null $limit + * @param int|string|null $cursor + * + * @return JSONResponse + */ + public function search(string $providerId, + string $term = '', + ?int $sortOrder = null, + ?int $limit = null, + $cursor = null): JSONResponse { + if (empty($term)) { + return new JSONResponse(null, Http::STATUS_BAD_REQUEST); + } + + return new JSONResponse( + $this->composer->search( + $this->userSession->getUser(), + $providerId, + new SearchQuery( + $term, + $sortOrder ?? ISearchQuery::SORT_DATE_DESC, + $limit ?? SearchQuery::LIMIT_DEFAULT, + $cursor + ) + ) + ); + } +} -- cgit v1.2.3 From 89ed2c37bf656ceb772bb6759c8977a7dc78b3fb Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 24 Jun 2020 16:49:16 +0200 Subject: Update share type constant usage Signed-off-by: Joas Schilling --- core/Controller/AutoCompleteController.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'core/Controller') diff --git a/core/Controller/AutoCompleteController.php b/core/Controller/AutoCompleteController.php index 0eebaabafd6..aa67ff9a30a 100644 --- a/core/Controller/AutoCompleteController.php +++ b/core/Controller/AutoCompleteController.php @@ -36,6 +36,7 @@ use OCP\Collaboration\AutoComplete\IManager; use OCP\Collaboration\Collaborators\ISearch; use OCP\IRequest; use OCP\Share; +use OCP\Share\IShare; use Symfony\Component\EventDispatcher\EventDispatcherInterface; class AutoCompleteController extends Controller { @@ -71,7 +72,7 @@ class AutoCompleteController extends Controller { * @param int $limit * @return DataResponse */ - public function get($search, $itemType, $itemId, $sorter = null, $shareTypes = [Share::SHARE_TYPE_USER], $limit = 10): DataResponse { + public function get($search, $itemType, $itemId, $sorter = null, $shareTypes = [IShare::TYPE_USER], $limit = 10): DataResponse { // if enumeration/user listings are disabled, we'll receive an empty // result from search() – thus nothing else to do here. [$results,] = $this->collaboratorSearch->search($search, $shareTypes, false, $limit, 0); -- cgit v1.2.3 From 35c6b1236fdb2d90e55315dc0c92b5ecb20641e7 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 16 Jun 2020 21:14:42 +0200 Subject: Move AutoComplete::filterResults to new event dispatcher and GenericEvent Signed-off-by: Joas Schilling --- core/Controller/AutoCompleteController.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'core/Controller') diff --git a/core/Controller/AutoCompleteController.php b/core/Controller/AutoCompleteController.php index aa67ff9a30a..56ad21f421c 100644 --- a/core/Controller/AutoCompleteController.php +++ b/core/Controller/AutoCompleteController.php @@ -34,17 +34,16 @@ use OCP\AppFramework\OCSController as Controller; use OCP\Collaboration\AutoComplete\AutoCompleteEvent; use OCP\Collaboration\AutoComplete\IManager; use OCP\Collaboration\Collaborators\ISearch; +use OCP\EventDispatcher\IEventDispatcher; use OCP\IRequest; -use OCP\Share; use OCP\Share\IShare; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; class AutoCompleteController extends Controller { /** @var ISearch */ private $collaboratorSearch; /** @var IManager */ private $autoCompleteManager; - /** @var EventDispatcherInterface */ + /** @var IEventDispatcher */ private $dispatcher; public function __construct( @@ -52,7 +51,7 @@ class AutoCompleteController extends Controller { IRequest $request, ISearch $collaboratorSearch, IManager $autoCompleteManager, - EventDispatcherInterface $dispatcher + IEventDispatcher $dispatcher ) { parent::__construct($appName, $request); -- cgit v1.2.3 From 543fabe27919df81e79a16644fe4eedf9eceb07c Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 17 Jul 2020 09:05:16 +0200 Subject: Make magic strings of ClientFlowLogin and v2 publicly available Signed-off-by: Joas Schilling --- core/Controller/ClientFlowLoginController.php | 12 ++++++------ core/Controller/ClientFlowLoginV2Controller.php | 18 +++++++++--------- 2 files changed, 15 insertions(+), 15 deletions(-) (limited to 'core/Controller') diff --git a/core/Controller/ClientFlowLoginController.php b/core/Controller/ClientFlowLoginController.php index 80cf94a7900..12c01cba651 100644 --- a/core/Controller/ClientFlowLoginController.php +++ b/core/Controller/ClientFlowLoginController.php @@ -78,7 +78,7 @@ class ClientFlowLoginController extends Controller { /** @var EventDispatcherInterface */ private $eventDispatcher; - public const stateName = 'client.flow.state.token'; + public const STATE_NAME = 'client.flow.state.token'; /** * @param string $appName @@ -135,7 +135,7 @@ class ClientFlowLoginController extends Controller { * @return bool */ private function isValidToken($stateToken) { - $currentToken = $this->session->get(self::stateName); + $currentToken = $this->session->get(self::STATE_NAME); if (!is_string($stateToken) || !is_string($currentToken)) { return false; } @@ -198,7 +198,7 @@ class ClientFlowLoginController extends Controller { 64, ISecureRandom::CHAR_LOWER.ISecureRandom::CHAR_UPPER.ISecureRandom::CHAR_DIGITS ); - $this->session->set(self::stateName, $stateToken); + $this->session->set(self::STATE_NAME, $stateToken); $csp = new Http\ContentSecurityPolicy(); if ($client) { @@ -286,11 +286,11 @@ class ClientFlowLoginController extends Controller { public function generateAppPassword($stateToken, $clientIdentifier = '') { if (!$this->isValidToken($stateToken)) { - $this->session->remove(self::stateName); + $this->session->remove(self::STATE_NAME); return $this->stateTokenForbiddenResponse(); } - $this->session->remove(self::stateName); + $this->session->remove(self::STATE_NAME); try { $sessionId = $this->session->getId(); @@ -343,7 +343,7 @@ class ClientFlowLoginController extends Controller { $this->accessTokenMapper->insert($accessToken); $redirectUri = $client->getRedirectUri(); - + if (parse_url($redirectUri, PHP_URL_QUERY)) { $redirectUri .= '&'; } else { diff --git a/core/Controller/ClientFlowLoginV2Controller.php b/core/Controller/ClientFlowLoginV2Controller.php index d5b50dd413c..e3644531393 100644 --- a/core/Controller/ClientFlowLoginV2Controller.php +++ b/core/Controller/ClientFlowLoginV2Controller.php @@ -44,8 +44,8 @@ use OCP\IURLGenerator; use OCP\Security\ISecureRandom; class ClientFlowLoginV2Controller extends Controller { - private const tokenName = 'client.flow.v2.login.token'; - private const stateName = 'client.flow.v2.state.token'; + public const TOKEN_NAME = 'client.flow.v2.login.token'; + public const STATE_NAME = 'client.flow.v2.state.token'; /** @var LoginFlowV2Service */ private $loginFlowV2Service; @@ -105,7 +105,7 @@ class ClientFlowLoginV2Controller extends Controller { return $this->loginTokenForbiddenResponse(); } - $this->session->set(self::tokenName, $token); + $this->session->set(self::TOKEN_NAME, $token); return new RedirectResponse( $this->urlGenerator->linkToRouteAbsolute('core.ClientFlowLoginV2.showAuthPickerPage') @@ -128,7 +128,7 @@ class ClientFlowLoginV2Controller extends Controller { 64, ISecureRandom::CHAR_LOWER.ISecureRandom::CHAR_UPPER.ISecureRandom::CHAR_DIGITS ); - $this->session->set(self::stateName, $stateToken); + $this->session->set(self::STATE_NAME, $stateToken); return new StandaloneTemplateResponse( $this->appName, @@ -188,11 +188,11 @@ class ClientFlowLoginV2Controller extends Controller { return $this->loginTokenForbiddenResponse(); } - $loginToken = $this->session->get(self::tokenName); + $loginToken = $this->session->get(self::TOKEN_NAME); // Clear session variables - $this->session->remove(self::tokenName); - $this->session->remove(self::stateName); + $this->session->remove(self::TOKEN_NAME); + $this->session->remove(self::STATE_NAME); $sessionId = $this->session->getId(); $result = $this->loginFlowV2Service->flowDone($loginToken, $sessionId, $this->getServerPath(), $this->userId); @@ -240,7 +240,7 @@ class ClientFlowLoginV2Controller extends Controller { } private function isValidStateToken(string $stateToken): bool { - $currentToken = $this->session->get(self::stateName); + $currentToken = $this->session->get(self::STATE_NAME); if (!is_string($stateToken) || !is_string($currentToken)) { return false; } @@ -265,7 +265,7 @@ class ClientFlowLoginV2Controller extends Controller { * @throws LoginFlowV2NotFoundException */ private function getFlowByLoginToken(): LoginFlowV2 { - $currentToken = $this->session->get(self::tokenName); + $currentToken = $this->session->get(self::TOKEN_NAME); if (!is_string($currentToken)) { throw new LoginFlowV2NotFoundException('Login token not set in session'); } -- cgit v1.2.3 From 1a1b3e20e470a945dd9f5fab1d99174b10cbb141 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Molakvo=C3=A6=20=28skjnldsv=29?= Date: Mon, 3 Aug 2020 12:54:37 +0200 Subject: Fix unified search MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ (skjnldsv) Signed-off-by: npmbuildbot[bot] --- core/Controller/UnifiedSearchController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core/Controller') diff --git a/core/Controller/UnifiedSearchController.php b/core/Controller/UnifiedSearchController.php index ddb1745dea5..ecc5192ff31 100644 --- a/core/Controller/UnifiedSearchController.php +++ b/core/Controller/UnifiedSearchController.php @@ -78,7 +78,7 @@ class UnifiedSearchController extends Controller { ?int $sortOrder = null, ?int $limit = null, $cursor = null): JSONResponse { - if (empty($term)) { + if (empty(trim($term))) { return new JSONResponse(null, Http::STATUS_BAD_REQUEST); } -- cgit v1.2.3 From d98f7c1bd83fc03fd297ebeac6279ffe17316950 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Molakvo=C3=A6=20=28skjnldsv=29?= Date: Tue, 4 Aug 2020 18:15:09 +0200 Subject: Make apps handle the order logic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ (skjnldsv) --- core/Controller/UnifiedSearchController.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'core/Controller') diff --git a/core/Controller/UnifiedSearchController.php b/core/Controller/UnifiedSearchController.php index ecc5192ff31..4aaa1b9b067 100644 --- a/core/Controller/UnifiedSearchController.php +++ b/core/Controller/UnifiedSearchController.php @@ -54,10 +54,14 @@ class UnifiedSearchController extends Controller { /** * @NoAdminRequired * @NoCSRFRequired + * + * @param string $from the url the user is currently at + * + * @return JSONResponse */ - public function getProviders(): JSONResponse { + public function getProviders(string $from): JSONResponse { return new JSONResponse( - $this->composer->getProviders() + $this->composer->getProviders($from) ); } -- cgit v1.2.3 From ea8f68bea6957ae459ff1ba6849b25354b3f0093 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 5 Aug 2020 09:49:18 +0200 Subject: Hand in the route and the parameters of the request Signed-off-by: Joas Schilling Signed-off-by: npmbuildbot[bot] --- core/Controller/UnifiedSearchController.php | 62 +++++++++++++++++++++++++---- 1 file changed, 55 insertions(+), 7 deletions(-) (limited to 'core/Controller') diff --git a/core/Controller/UnifiedSearchController.php b/core/Controller/UnifiedSearchController.php index 4aaa1b9b067..839bbde1003 100644 --- a/core/Controller/UnifiedSearchController.php +++ b/core/Controller/UnifiedSearchController.php @@ -32,7 +32,9 @@ use OCP\AppFramework\Http; use OCP\AppFramework\Http\JSONResponse; use OCP\IRequest; use OCP\IUserSession; +use OCP\Route\IRouter; use OCP\Search\ISearchQuery; +use Symfony\Component\Routing\Exception\ResourceNotFoundException; class UnifiedSearchController extends Controller { @@ -42,26 +44,33 @@ class UnifiedSearchController extends Controller { /** @var IUserSession */ private $userSession; + /** @var IRouter */ + private $router; + public function __construct(IRequest $request, IUserSession $userSession, - SearchComposer $composer) { + SearchComposer $composer, + IRouter $router) { parent::__construct('core', $request); $this->composer = $composer; $this->userSession = $userSession; + $this->router = $router; } /** * @NoAdminRequired * @NoCSRFRequired - * + * * @param string $from the url the user is currently at - * + * * @return JSONResponse */ - public function getProviders(string $from): JSONResponse { + public function getProviders(string $from = ''): JSONResponse { + [$route, $parameters] = $this->getRouteInformation($from); + return new JSONResponse( - $this->composer->getProviders($from) + $this->composer->getProviders($route, $parameters) ); } @@ -74,6 +83,7 @@ class UnifiedSearchController extends Controller { * @param int|null $sortOrder * @param int|null $limit * @param int|string|null $cursor + * @param string $from * * @return JSONResponse */ @@ -81,10 +91,12 @@ class UnifiedSearchController extends Controller { string $term = '', ?int $sortOrder = null, ?int $limit = null, - $cursor = null): JSONResponse { + $cursor = null, + string $from = ''): JSONResponse { if (empty(trim($term))) { return new JSONResponse(null, Http::STATUS_BAD_REQUEST); } + [$route, $routeParameters] = $this->getRouteInformation($from); return new JSONResponse( $this->composer->search( @@ -94,9 +106,45 @@ class UnifiedSearchController extends Controller { $term, $sortOrder ?? ISearchQuery::SORT_DATE_DESC, $limit ?? SearchQuery::LIMIT_DEFAULT, - $cursor + $cursor, + $route, + $routeParameters ) ) ); } + + protected function getRouteInformation(string $url): array { + $routeStr = ''; + $parameters = []; + + if ($url !== '') { + $urlParts = parse_url($url); + + try { + $parameters = $this->router->findMatchingRoute($urlParts['path']); + + // contacts.PageController.index => contacts.Page.index + $route = $parameters['caller']; + if (substr($route[1], -10) === 'Controller') { + $route[1] = substr($route[1], 0, -10); + } + $routeStr = implode('.', $route); + + // cleanup + unset($parameters['_route'], $parameters['action'], $parameters['caller']); + } catch (ResourceNotFoundException $exception) { + } + + if (isset($urlParts['query'])) { + parse_str($urlParts['query'], $queryParameters); + $parameters = array_merge($parameters, $queryParameters); + } + } + + return [ + $routeStr, + $parameters, + ]; + } } -- cgit v1.2.3 From 2a054e6c04e0a40421510eb889cbf59f153c5177 Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Mon, 24 Aug 2020 14:54:25 +0200 Subject: Update the license headers for Nextcloud 20 Signed-off-by: Christoph Wurst --- core/Controller/ClientFlowLoginController.php | 1 + core/Controller/ClientFlowLoginV2Controller.php | 1 + core/Controller/OCSController.php | 1 + core/Controller/SearchController.php | 1 + core/Controller/UnifiedSearchController.php | 7 +++++-- 5 files changed, 9 insertions(+), 2 deletions(-) (limited to 'core/Controller') diff --git a/core/Controller/ClientFlowLoginController.php b/core/Controller/ClientFlowLoginController.php index 12c01cba651..9a7296281b0 100644 --- a/core/Controller/ClientFlowLoginController.php +++ b/core/Controller/ClientFlowLoginController.php @@ -5,6 +5,7 @@ * @author Bjoern Schiessle * @author Christoph Wurst * @author Daniel Kesselberg + * @author Joas Schilling * @author Lukas Reschke * @author Mario Danic * @author Morris Jobke diff --git a/core/Controller/ClientFlowLoginV2Controller.php b/core/Controller/ClientFlowLoginV2Controller.php index e3644531393..103d659ecd2 100644 --- a/core/Controller/ClientFlowLoginV2Controller.php +++ b/core/Controller/ClientFlowLoginV2Controller.php @@ -6,6 +6,7 @@ declare(strict_types=1); * @copyright Copyright (c) 2019, Roeland Jago Douma * * @author Christoph Wurst + * @author Joas Schilling * @author Roeland Jago Douma * * @license GNU AGPL version 3 or any later version diff --git a/core/Controller/OCSController.php b/core/Controller/OCSController.php index 057dee78676..f502f038eb8 100644 --- a/core/Controller/OCSController.php +++ b/core/Controller/OCSController.php @@ -3,6 +3,7 @@ * * * @author Christoph Wurst + * @author Daniel Kesselberg * @author Joas Schilling * @author Julius Härtl * @author Lukas Reschke diff --git a/core/Controller/SearchController.php b/core/Controller/SearchController.php index a24aa7fa1ec..72633630dad 100644 --- a/core/Controller/SearchController.php +++ b/core/Controller/SearchController.php @@ -5,6 +5,7 @@ declare(strict_types=1); /** * @copyright 2018, Roeland Jago Douma * + * @author Robin Appelman * @author Roeland Jago Douma * * @license GNU AGPL version 3 or any later version diff --git a/core/Controller/UnifiedSearchController.php b/core/Controller/UnifiedSearchController.php index 839bbde1003..1bdfd500676 100644 --- a/core/Controller/UnifiedSearchController.php +++ b/core/Controller/UnifiedSearchController.php @@ -5,7 +5,9 @@ declare(strict_types=1); /** * @copyright 2020 Christoph Wurst * - * @author 2020 Christoph Wurst + * @author Christoph Wurst + * @author Joas Schilling + * @author John Molakvoæ (skjnldsv) * * @license GNU AGPL version 3 or any later version * @@ -20,7 +22,8 @@ declare(strict_types=1); * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * along with this program. If not, see . + * */ namespace OC\Core\Controller; -- cgit v1.2.3 From a4b2403e293f0ed8f0a63892f9cd14929d28073e Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 3 Sep 2020 15:46:21 +0200 Subject: The privacy setting is only about syncing to other servers Signed-off-by: Joas Schilling --- core/Controller/AvatarController.php | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'core/Controller') diff --git a/core/Controller/AvatarController.php b/core/Controller/AvatarController.php index dc6febc467f..cbcb9783680 100644 --- a/core/Controller/AvatarController.php +++ b/core/Controller/AvatarController.php @@ -126,21 +126,6 @@ class AvatarController extends Controller { $size = 64; } - $user = $this->userManager->get($userId); - if ($user === null) { - return new JSONResponse([], Http::STATUS_NOT_FOUND); - } - - $account = $this->accountManager->getAccount($user); - $scope = $account->getProperty(IAccountManager::PROPERTY_AVATAR)->getScope(); - - if ($scope !== IAccountManager::VISIBILITY_PUBLIC && $this->userId === null) { - // Public avatar access is not allowed - $response = new JSONResponse([], Http::STATUS_NOT_FOUND); - $response->cacheFor(1800); - return $response; - } - try { $avatar = $this->avatarManager->getAvatar($userId); $avatarFile = $avatar->getFile($size); -- cgit v1.2.3 From fea294bb29a2b58e93993914c11603278ebc7456 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 7 Sep 2020 10:47:10 +0200 Subject: Move unified search to OCS api Signed-off-by: Joas Schilling --- core/Controller/UnifiedSearchController.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'core/Controller') diff --git a/core/Controller/UnifiedSearchController.php b/core/Controller/UnifiedSearchController.php index 1bdfd500676..e4593ff4174 100644 --- a/core/Controller/UnifiedSearchController.php +++ b/core/Controller/UnifiedSearchController.php @@ -30,16 +30,16 @@ namespace OC\Core\Controller; use OC\Search\SearchComposer; use OC\Search\SearchQuery; -use OCP\AppFramework\Controller; +use OCP\AppFramework\OCSController; use OCP\AppFramework\Http; -use OCP\AppFramework\Http\JSONResponse; +use OCP\AppFramework\Http\DataResponse; use OCP\IRequest; use OCP\IUserSession; use OCP\Route\IRouter; use OCP\Search\ISearchQuery; use Symfony\Component\Routing\Exception\ResourceNotFoundException; -class UnifiedSearchController extends Controller { +class UnifiedSearchController extends OCSController { /** @var SearchComposer */ private $composer; @@ -67,12 +67,12 @@ class UnifiedSearchController extends Controller { * * @param string $from the url the user is currently at * - * @return JSONResponse + * @return DataResponse */ - public function getProviders(string $from = ''): JSONResponse { + public function getProviders(string $from = ''): DataResponse { [$route, $parameters] = $this->getRouteInformation($from); - return new JSONResponse( + return new DataResponse( $this->composer->getProviders($route, $parameters) ); } @@ -88,20 +88,20 @@ class UnifiedSearchController extends Controller { * @param int|string|null $cursor * @param string $from * - * @return JSONResponse + * @return DataResponse */ public function search(string $providerId, string $term = '', ?int $sortOrder = null, ?int $limit = null, $cursor = null, - string $from = ''): JSONResponse { + string $from = ''): DataResponse { if (empty(trim($term))) { - return new JSONResponse(null, Http::STATUS_BAD_REQUEST); + return new DataResponse(null, Http::STATUS_BAD_REQUEST); } [$route, $routeParameters] = $this->getRouteInformation($from); - return new JSONResponse( + return new DataResponse( $this->composer->search( $this->userSession->getUser(), $providerId, -- cgit v1.2.3 From c2bef528efe34c50425fe4415e826929b1f78530 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 8 Sep 2020 10:45:35 +0200 Subject: Remove unused members and imports Signed-off-by: Joas Schilling --- core/Controller/AvatarController.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'core/Controller') diff --git a/core/Controller/AvatarController.php b/core/Controller/AvatarController.php index cbcb9783680..c94d98da13e 100644 --- a/core/Controller/AvatarController.php +++ b/core/Controller/AvatarController.php @@ -31,7 +31,6 @@ namespace OC\Core\Controller; use OC\AppFramework\Utility\TimeFactory; -use OCP\Accounts\IAccountManager; use OCP\AppFramework\Controller; use OCP\AppFramework\Http; use OCP\AppFramework\Http\DataDisplayResponse; @@ -80,8 +79,6 @@ class AvatarController extends Controller { /** @var TimeFactory */ protected $timeFactory; - /** @var IAccountManager */ - private $accountManager; public function __construct($appName, IRequest $request, @@ -92,8 +89,7 @@ class AvatarController extends Controller { IRootFolder $rootFolder, ILogger $logger, $userId, - TimeFactory $timeFactory, - IAccountManager $accountManager) { + TimeFactory $timeFactory) { parent::__construct($appName, $request); $this->avatarManager = $avatarManager; @@ -104,7 +100,6 @@ class AvatarController extends Controller { $this->logger = $logger; $this->userId = $userId; $this->timeFactory = $timeFactory; - $this->accountManager = $accountManager; } -- cgit v1.2.3 From a8d9b22beba9701c5b8b5c8b0f565ada087ec3f9 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 15 Sep 2020 09:19:53 +0200 Subject: Add an ETag for the search providers Signed-off-by: Joas Schilling --- core/Controller/UnifiedSearchController.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'core/Controller') diff --git a/core/Controller/UnifiedSearchController.php b/core/Controller/UnifiedSearchController.php index e4593ff4174..c2949ce6095 100644 --- a/core/Controller/UnifiedSearchController.php +++ b/core/Controller/UnifiedSearchController.php @@ -72,9 +72,10 @@ class UnifiedSearchController extends OCSController { public function getProviders(string $from = ''): DataResponse { [$route, $parameters] = $this->getRouteInformation($from); - return new DataResponse( - $this->composer->getProviders($route, $parameters) - ); + $result = $this->composer->getProviders($route, $parameters); + $response = new DataResponse($result); + $response->setETag(md5(json_encode($result))); + return $response; } /** -- cgit v1.2.3 From d9015a8c94bfd71fe484618a06d276701d3bf9ff Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Mon, 5 Oct 2020 15:12:57 +0200 Subject: Format code to a single space around binary operators Signed-off-by: Christoph Wurst --- core/Controller/AvatarController.php | 6 +++--- core/Controller/LostController.php | 6 +++--- core/Controller/SetupController.php | 2 +- core/Controller/SvgController.php | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) (limited to 'core/Controller') diff --git a/core/Controller/AvatarController.php b/core/Controller/AvatarController.php index c94d98da13e..ca3a739bf9f 100644 --- a/core/Controller/AvatarController.php +++ b/core/Controller/AvatarController.php @@ -134,7 +134,7 @@ class AvatarController extends Controller { } // Cache for 1 day - $response->cacheFor(60*60*24); + $response->cacheFor(60 * 60 * 24); return $response; } @@ -155,7 +155,7 @@ class AvatarController extends Controller { if (!($node instanceof File)) { return new JSONResponse(['data' => ['message' => $this->l->t('Please select a file.')]]); } - if ($node->getSize() > 20*1024*1024) { + if ($node->getSize() > 20 * 1024 * 1024) { return new JSONResponse( ['data' => ['message' => $this->l->t('File is too big')]], Http::STATUS_BAD_REQUEST @@ -183,7 +183,7 @@ class AvatarController extends Controller { is_uploaded_file($files['tmp_name'][0]) && !\OC\Files\Filesystem::isFileBlacklisted($files['tmp_name'][0]) ) { - if ($files['size'][0] > 20*1024*1024) { + if ($files['size'][0] > 20 * 1024 * 1024) { return new JSONResponse( ['data' => ['message' => $this->l->t('File is too big')]], Http::STATUS_BAD_REQUEST diff --git a/core/Controller/LostController.php b/core/Controller/LostController.php index 0a2e8d6b73d..861a701facd 100644 --- a/core/Controller/LostController.php +++ b/core/Controller/LostController.php @@ -216,7 +216,7 @@ class LostController extends Controller { throw new \Exception($this->l10n->t('Couldn\'t reset password because the token is invalid')); } - if ($splittedToken[0] < ($this->timeFactory->getTime() - 60*60*24*7) || + if ($splittedToken[0] < ($this->timeFactory->getTime() - 60 * 60 * 24 * 7) || $user->getLastLogin() > $splittedToken[0]) { throw new \Exception($this->l10n->t('Couldn\'t reset password because the token is expired')); } @@ -231,7 +231,7 @@ class LostController extends Controller { * @param array $additional * @return array */ - private function error($message, array $additional=[]) { + private function error($message, array $additional = []) { return array_merge(['status' => 'error', 'msg' => $message], $additional); } @@ -240,7 +240,7 @@ class LostController extends Controller { * @return array */ private function success($data = []) { - return array_merge($data, ['status'=>'success']); + return array_merge($data, ['status' => 'success']); } /** diff --git a/core/Controller/SetupController.php b/core/Controller/SetupController.php index dd7e4eefc81..96dad865c4b 100644 --- a/core/Controller/SetupController.php +++ b/core/Controller/SetupController.php @@ -70,7 +70,7 @@ class SetupController { return; } - if (isset($post['install']) and $post['install']=='true') { + if (isset($post['install']) and $post['install'] == 'true') { // We have to launch the installation process : $e = $this->setupHelper->install($post); $errors = ['errors' => $e]; diff --git a/core/Controller/SvgController.php b/core/Controller/SvgController.php index 573f245c5a1..b526d3b1491 100644 --- a/core/Controller/SvgController.php +++ b/core/Controller/SvgController.php @@ -62,7 +62,7 @@ class SvgController extends Controller { IconsCacher $iconsCacher) { parent::__construct($appName, $request); - $this->serverRoot = \OC::$SERVERROOT; + $this->serverRoot = \OC::$SERVERROOT; $this->timeFactory = $timeFactory; $this->appManager = $appManager; $this->iconsCacher = $iconsCacher; -- cgit v1.2.3 From e7f5516b4d04c16ed2c12dcc9c9c5f34d9f1f73b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Molakvo=C3=A6=20=28skjnldsv=29?= Date: Sun, 4 Oct 2020 15:33:17 +0200 Subject: Init vue comments tab MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ (skjnldsv) --- core/Controller/AutoCompleteController.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'core/Controller') diff --git a/core/Controller/AutoCompleteController.php b/core/Controller/AutoCompleteController.php index 56ad21f421c..0a29d2fa157 100644 --- a/core/Controller/AutoCompleteController.php +++ b/core/Controller/AutoCompleteController.php @@ -41,18 +41,18 @@ use OCP\Share\IShare; class AutoCompleteController extends Controller { /** @var ISearch */ private $collaboratorSearch; + /** @var IManager */ private $autoCompleteManager; + /** @var IEventDispatcher */ private $dispatcher; - public function __construct( - string $appName, - IRequest $request, - ISearch $collaboratorSearch, - IManager $autoCompleteManager, - IEventDispatcher $dispatcher - ) { + public function __construct(string $appName, + IRequest $request, + ISearch $collaboratorSearch, + IManager $autoCompleteManager, + IEventDispatcher $dispatcher) { parent::__construct($appName, $request); $this->collaboratorSearch = $collaboratorSearch; @@ -114,7 +114,10 @@ class AutoCompleteController extends Controller { $output[] = [ 'id' => (string) $result['value']['shareWith'], 'label' => $result['label'], + 'icon' => $result['icon'], 'source' => $type, + 'status' => $result['status'], + 'subline' => $result['subline'] ]; } } -- cgit v1.2.3 From df769c025ab12cb5caad07ea9370a188201c796e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Mon, 7 Dec 2020 07:39:25 +0100 Subject: Do not load nonexisting setup.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- core/Controller/SetupController.php | 1 - 1 file changed, 1 deletion(-) (limited to 'core/Controller') diff --git a/core/Controller/SetupController.php b/core/Controller/SetupController.php index 96dad865c4b..6d117eafd59 100644 --- a/core/Controller/SetupController.php +++ b/core/Controller/SetupController.php @@ -104,7 +104,6 @@ class SetupController { ]; $parameters = array_merge($defaults, $post); - \OC_Util::addScript('setup'); \OC_Template::printGuestPage('', 'installation', $parameters); } -- cgit v1.2.3 From 6995223b1ed202c7f8e920e83cb5b53efd7ce761 Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Mon, 14 Dec 2020 15:56:07 +0100 Subject: Add well known handlers API Signed-off-by: Christoph Wurst --- core/Controller/WellKnownController.php | 67 +++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 core/Controller/WellKnownController.php (limited to 'core/Controller') diff --git a/core/Controller/WellKnownController.php b/core/Controller/WellKnownController.php new file mode 100644 index 00000000000..1d45e87569b --- /dev/null +++ b/core/Controller/WellKnownController.php @@ -0,0 +1,67 @@ + + * + * @author 2020 Christoph Wurst + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +namespace OC\Core\Controller; + +use OC\Http\WellKnown\RequestManager; +use OCP\AppFramework\Controller; +use OCP\AppFramework\Http; +use OCP\AppFramework\Http\JSONResponse; +use OCP\AppFramework\Http\Response; +use OCP\IRequest; + +class WellKnownController extends Controller { + + /** @var RequestManager */ + private $requestManager; + + public function __construct(IRequest $request, + RequestManager $wellKnownManager) { + parent::__construct('core', $request); + $this->requestManager = $wellKnownManager; + } + + /** + * @PublicPage + * @NoCSRFRequired + * + * @return Response + */ + public function handle(string $service): Response { + $response = $this->requestManager->process( + $service, + $this->request + ); + + if ($response === null) { + $httpResponse = new JSONResponse(["message" => "$service not supported"], Http::STATUS_NOT_FOUND); + } else { + $httpResponse = $response->toHttpResponse(); + } + + // We add a custom header so that setup checks can detect if their requests are answered by this controller + return $httpResponse->addHeader('X-NEXTCLOUD-WELL-KNOWN', '1'); + } +} -- cgit v1.2.3 From d89a75be0b01f0423a7c1ad2d58aac73c3cc1f3a Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Wed, 16 Dec 2020 14:54:15 +0100 Subject: Update all license headers for Nextcloud 21 Signed-off-by: Christoph Wurst --- core/Controller/AutoCompleteController.php | 1 + core/Controller/AvatarController.php | 2 +- core/Controller/SvgController.php | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) (limited to 'core/Controller') diff --git a/core/Controller/AutoCompleteController.php b/core/Controller/AutoCompleteController.php index 0a29d2fa157..63a95531e82 100644 --- a/core/Controller/AutoCompleteController.php +++ b/core/Controller/AutoCompleteController.php @@ -8,6 +8,7 @@ declare(strict_types=1); * @author Arthur Schiwon * @author Christoph Wurst * @author Joas Schilling + * @author John Molakvoæ (skjnldsv) * @author Roeland Jago Douma * * @license GNU AGPL version 3 or any later version diff --git a/core/Controller/AvatarController.php b/core/Controller/AvatarController.php index ca3a739bf9f..69ec2f4bffe 100644 --- a/core/Controller/AvatarController.php +++ b/core/Controller/AvatarController.php @@ -10,7 +10,7 @@ * @author Morris Jobke * @author Roeland Jago Douma * @author Thomas Müller - * @author Vincent Petry + * @author Vincent Petry * * @license AGPL-3.0 * diff --git a/core/Controller/SvgController.php b/core/Controller/SvgController.php index b526d3b1491..ff0a21ba516 100644 --- a/core/Controller/SvgController.php +++ b/core/Controller/SvgController.php @@ -5,6 +5,7 @@ declare(strict_types=1); /** * @copyright Copyright (c) 2018, John Molakvoæ (skjnldsv@protonmail.com) * + * @author Christoph Wurst * @author Daniel Kesselberg * @author Joas Schilling * @author John Molakvoæ (skjnldsv) -- cgit v1.2.3 From 9ce3ea3368937f827171d1ee3aa6a202d93e6cd2 Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Wed, 30 Dec 2020 14:07:05 +0100 Subject: Update license headers Signed-off-by: Christoph Wurst --- core/Controller/WellKnownController.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'core/Controller') diff --git a/core/Controller/WellKnownController.php b/core/Controller/WellKnownController.php index 1d45e87569b..640aa33f49f 100644 --- a/core/Controller/WellKnownController.php +++ b/core/Controller/WellKnownController.php @@ -2,10 +2,10 @@ declare(strict_types=1); -/* +/** * @copyright 2020 Christoph Wurst * - * @author 2020 Christoph Wurst + * @author Christoph Wurst * * @license GNU AGPL version 3 or any later version * @@ -20,7 +20,8 @@ declare(strict_types=1); * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * along with this program. If not, see . + * */ namespace OC\Core\Controller; -- cgit v1.2.3 From f57b93098b4bc9b621f766b491b4f19c5b88d711 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Fri, 15 Jan 2021 09:29:54 +0100 Subject: Do not redirect to logout after login This can happen when the session was killed due to a timeout. Then logout was triggered. Nobody wants to login only to be logged out again. Signed-off-by: Roeland Jago Douma --- core/Controller/LoginController.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'core/Controller') diff --git a/core/Controller/LoginController.php b/core/Controller/LoginController.php index 7073584a66b..097a7708318 100644 --- a/core/Controller/LoginController.php +++ b/core/Controller/LoginController.php @@ -175,7 +175,10 @@ class LoginController extends Controller { ); if (!empty($redirect_url)) { - $this->initialStateService->provideInitialState('core', 'loginRedirectUrl', $redirect_url); + [$url, ] = explode('?', $redirect_url); + if ($url !== $this->urlGenerator->linkToRoute('core.login.logout')) { + $this->initialStateService->provideInitialState('core', 'loginRedirectUrl', $redirect_url); + } } $this->initialStateService->provideInitialState( -- cgit v1.2.3 From d7a80293ab4d18953244e375c3311df2343abf69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Mon, 1 Feb 2021 14:25:56 +0100 Subject: Keep direct login active when redirecting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- core/Controller/LoginController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core/Controller') diff --git a/core/Controller/LoginController.php b/core/Controller/LoginController.php index 097a7708318..753631ddf6f 100644 --- a/core/Controller/LoginController.php +++ b/core/Controller/LoginController.php @@ -337,7 +337,7 @@ class LoginController extends Controller { $user, $originalUser, $redirect_url, string $loginMessage) { // Read current user and append if possible we need to // return the unmodified user otherwise we will leak the login name - $args = $user !== null ? ['user' => $originalUser] : []; + $args = $user !== null ? ['user' => $originalUser, 'direct' => 1] : []; if ($redirect_url !== null) { $args['redirect_url'] = $redirect_url; } -- cgit v1.2.3 From f8808e260dacfd8214e405d493365f4ecaf4d953 Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Tue, 9 Feb 2021 11:51:09 +0100 Subject: Move app_password_created to a typed event Signed-off-by: Christoph Wurst --- core/Controller/AppPasswordController.php | 13 +++++++------ core/Controller/ClientFlowLoginController.php | 15 ++++++++------- 2 files changed, 15 insertions(+), 13 deletions(-) (limited to 'core/Controller') diff --git a/core/Controller/AppPasswordController.php b/core/Controller/AppPasswordController.php index 2f8c1184def..15f86b4ad6a 100644 --- a/core/Controller/AppPasswordController.php +++ b/core/Controller/AppPasswordController.php @@ -27,6 +27,7 @@ declare(strict_types=1); namespace OC\Core\Controller; +use OC\Authentication\Events\AppPasswordCreatedEvent; use OC\Authentication\Exceptions\InvalidTokenException; use OC\Authentication\Token\IProvider; use OC\Authentication\Token\IToken; @@ -35,11 +36,10 @@ use OCP\AppFramework\OCS\OCSForbiddenException; use OCP\Authentication\Exceptions\CredentialsUnavailableException; use OCP\Authentication\Exceptions\PasswordUnavailableException; use OCP\Authentication\LoginCredentials\IStore; +use OCP\EventDispatcher\IEventDispatcher; use OCP\IRequest; use OCP\ISession; use OCP\Security\ISecureRandom; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\EventDispatcher\GenericEvent; class AppPasswordController extends \OCP\AppFramework\OCSController { @@ -55,7 +55,7 @@ class AppPasswordController extends \OCP\AppFramework\OCSController { /** @var IStore */ private $credentialStore; - /** @var EventDispatcherInterface */ + /** @var IEventDispatcher */ private $eventDispatcher; public function __construct(string $appName, @@ -64,7 +64,7 @@ class AppPasswordController extends \OCP\AppFramework\OCSController { ISecureRandom $random, IProvider $tokenProvider, IStore $credentialStore, - EventDispatcherInterface $eventDispatcher) { + IEventDispatcher $eventDispatcher) { parent::__construct($appName, $request); $this->session = $session; @@ -112,8 +112,9 @@ class AppPasswordController extends \OCP\AppFramework\OCSController { IToken::DO_NOT_REMEMBER ); - $event = new GenericEvent($generatedToken); - $this->eventDispatcher->dispatch('app_password_created', $event); + $this->eventDispatcher->dispatchTyped( + new AppPasswordCreatedEvent($generatedToken) + ); return new DataResponse([ 'apppassword' => $token diff --git a/core/Controller/ClientFlowLoginController.php b/core/Controller/ClientFlowLoginController.php index 9a7296281b0..b7599acc3c6 100644 --- a/core/Controller/ClientFlowLoginController.php +++ b/core/Controller/ClientFlowLoginController.php @@ -32,6 +32,7 @@ namespace OC\Core\Controller; +use OC\Authentication\Events\AppPasswordCreatedEvent; use OC\Authentication\Exceptions\InvalidTokenException; use OC\Authentication\Exceptions\PasswordlessTokenException; use OC\Authentication\Token\IProvider; @@ -44,6 +45,7 @@ use OCP\AppFramework\Http; use OCP\AppFramework\Http\Response; use OCP\AppFramework\Http\StandaloneTemplateResponse; use OCP\Defaults; +use OCP\EventDispatcher\IEventDispatcher; use OCP\IL10N; use OCP\IRequest; use OCP\ISession; @@ -52,8 +54,6 @@ use OCP\IUserSession; use OCP\Security\ICrypto; use OCP\Security\ISecureRandom; use OCP\Session\Exceptions\SessionNotAvailableException; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\EventDispatcher\GenericEvent; class ClientFlowLoginController extends Controller { /** @var IUserSession */ @@ -76,7 +76,7 @@ class ClientFlowLoginController extends Controller { private $accessTokenMapper; /** @var ICrypto */ private $crypto; - /** @var EventDispatcherInterface */ + /** @var IEventDispatcher */ private $eventDispatcher; public const STATE_NAME = 'client.flow.state.token'; @@ -94,7 +94,7 @@ class ClientFlowLoginController extends Controller { * @param ClientMapper $clientMapper * @param AccessTokenMapper $accessTokenMapper * @param ICrypto $crypto - * @param EventDispatcherInterface $eventDispatcher + * @param IEventDispatcher $eventDispatcher */ public function __construct($appName, IRequest $request, @@ -108,7 +108,7 @@ class ClientFlowLoginController extends Controller { ClientMapper $clientMapper, AccessTokenMapper $accessTokenMapper, ICrypto $crypto, - EventDispatcherInterface $eventDispatcher) { + IEventDispatcher $eventDispatcher) { parent::__construct($appName, $request); $this->userSession = $userSession; $this->l10n = $l10n; @@ -364,8 +364,9 @@ class ClientFlowLoginController extends Controller { $this->tokenProvider->invalidateToken($sessionId); } - $event = new GenericEvent($generatedToken); - $this->eventDispatcher->dispatch('app_password_created', $event); + $this->eventDispatcher->dispatchTyped( + new AppPasswordCreatedEvent($generatedToken) + ); return new Http\RedirectResponse($redirectUri); } -- cgit v1.2.3 From 83755b7b02bc6f1a76f46a732b2595c0c5326346 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 12 Feb 2021 16:21:47 +0100 Subject: Make new result parts optional Signed-off-by: Joas Schilling --- core/Controller/AutoCompleteController.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'core/Controller') diff --git a/core/Controller/AutoCompleteController.php b/core/Controller/AutoCompleteController.php index 63a95531e82..74f5db485c8 100644 --- a/core/Controller/AutoCompleteController.php +++ b/core/Controller/AutoCompleteController.php @@ -115,10 +115,10 @@ class AutoCompleteController extends Controller { $output[] = [ 'id' => (string) $result['value']['shareWith'], 'label' => $result['label'], - 'icon' => $result['icon'], + 'icon' => $result['icon'] ?? '', 'source' => $type, - 'status' => $result['status'], - 'subline' => $result['subline'] + 'status' => $result['status'] ?? '', + 'subline' => $result['subline'] ?? '', ]; } } -- cgit v1.2.3 From 6ed4aaeeeaf1443a6abbd8d21bbd8dbde1dbdacf Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 18 Feb 2021 12:38:43 +0100 Subject: Send emails on password reset to the displayname Signed-off-by: Joas Schilling --- core/Controller/LostController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core/Controller') diff --git a/core/Controller/LostController.php b/core/Controller/LostController.php index 861a701facd..eedb9eef542 100644 --- a/core/Controller/LostController.php +++ b/core/Controller/LostController.php @@ -378,7 +378,7 @@ class LostController extends Controller { try { $message = $this->mailer->createMessage(); - $message->setTo([$email => $user->getUID()]); + $message->setTo([$email => $user->getDisplayName()]); $message->setFrom([$this->from => $this->defaults->getName()]); $message->useTemplate($emailTemplate); $this->mailer->send($message); -- cgit v1.2.3 From eb502c02ff7693bb36318d857985f79e7bac370c Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 12 Jan 2021 09:15:48 +0000 Subject: Bump nextcloud/coding-standard from 0.3.0 to 0.5.0 Bumps [nextcloud/coding-standard](https://github.com/nextcloud/coding-standard) from 0.3.0 to 0.5.0. - [Release notes](https://github.com/nextcloud/coding-standard/releases) - [Changelog](https://github.com/nextcloud/coding-standard/blob/master/CHANGELOG.md) - [Commits](https://github.com/nextcloud/coding-standard/compare/v0.3.0...v0.5.0) Signed-off-by: dependabot-preview[bot] Signed-off-by: Christoph Wurst --- core/Controller/LoginController.php | 2 +- core/Controller/OCSController.php | 2 +- core/Controller/TwoFactorChallengeController.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'core/Controller') diff --git a/core/Controller/LoginController.php b/core/Controller/LoginController.php index 753631ddf6f..7ec8f4843e8 100644 --- a/core/Controller/LoginController.php +++ b/core/Controller/LoginController.php @@ -156,7 +156,7 @@ class LoginController extends Controller { $loginMessages = $this->session->get('loginMessages'); if (is_array($loginMessages)) { - list($errors, $messages) = $loginMessages; + [$errors, $messages] = $loginMessages; $this->initialStateService->provideInitialState('core', 'loginMessages', $messages); $this->initialStateService->provideInitialState('core', 'loginErrors', $errors); } diff --git a/core/Controller/OCSController.php b/core/Controller/OCSController.php index f502f038eb8..f3a65420bd7 100644 --- a/core/Controller/OCSController.php +++ b/core/Controller/OCSController.php @@ -93,7 +93,7 @@ class OCSController extends \OCP\AppFramework\OCSController { */ public function getCapabilities() { $result = []; - list($major, $minor, $micro) = \OCP\Util::getVersion(); + [$major, $minor, $micro] = \OCP\Util::getVersion(); $result['version'] = [ 'major' => $major, 'minor' => $minor, diff --git a/core/Controller/TwoFactorChallengeController.php b/core/Controller/TwoFactorChallengeController.php index 251ae85b3f7..a9e1ee35917 100644 --- a/core/Controller/TwoFactorChallengeController.php +++ b/core/Controller/TwoFactorChallengeController.php @@ -108,7 +108,7 @@ class TwoFactorChallengeController extends Controller { $user = $this->userSession->getUser(); $providerSet = $this->twoFactorManager->getProviderSet($user); $allProviders = $providerSet->getProviders(); - list($providers, $backupProvider) = $this->splitProvidersAndBackupCodes($allProviders); + [$providers, $backupProvider] = $this->splitProvidersAndBackupCodes($allProviders); $setupProviders = $this->twoFactorManager->getLoginSetupProviders($user); $data = [ -- cgit v1.2.3 From 4076dfb0194a00f4795e87f2ae84e626a174bd06 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Wed, 3 Mar 2021 11:18:33 +0100 Subject: Allow admins to disable the login form In case they want to not allow this because they use SSO (and do not want the users to enter their credentials there by accident). ?direct=1 still works. Signed-off-by: Roeland Jago Douma --- core/Controller/LoginController.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'core/Controller') diff --git a/core/Controller/LoginController.php b/core/Controller/LoginController.php index 7ec8f4843e8..e466f029ec1 100644 --- a/core/Controller/LoginController.php +++ b/core/Controller/LoginController.php @@ -191,6 +191,8 @@ class LoginController extends Controller { $this->initialStateService->provideInitialState('core', 'webauthn-available', $this->webAuthnManager->isWebAuthnAvailable()); + $this->initialStateService->provideInitialState('core', 'hideLoginForm', $this->config->getSystemValueBool('hide_login_form', false)); + // OpenGraph Support: http://ogp.me/ Util::addHeader('meta', ['property' => 'og:title', 'content' => Util::sanitizeHTML($this->defaults->getName())]); Util::addHeader('meta', ['property' => 'og:description', 'content' => Util::sanitizeHTML($this->defaults->getSlogan())]); -- cgit v1.2.3 From b38618c8139a8017590ea59064184307a93f9808 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 19 Mar 2021 14:47:30 +0100 Subject: use node search api for legacy file search endpoint Signed-off-by: Robin Appelman --- core/Controller/SearchController.php | 1 + 1 file changed, 1 insertion(+) (limited to 'core/Controller') diff --git a/core/Controller/SearchController.php b/core/Controller/SearchController.php index 72633630dad..42439e9ceb9 100644 --- a/core/Controller/SearchController.php +++ b/core/Controller/SearchController.php @@ -55,6 +55,7 @@ class SearchController extends Controller { /** * @NoAdminRequired + * @NoCSRFRequired */ public function search(string $query, array $inApps = [], int $page = 1, int $size = 30): JSONResponse { $results = $this->searcher->searchPaged($query, $inApps, $page, $size); -- cgit v1.2.3 From 7b6989747463773dcd4d3bba3854b8e713a1d214 Mon Sep 17 00:00:00 2001 From: Julien Veyssier Date: Thu, 1 Apr 2021 11:42:39 +0200 Subject: show informative errors in log and UI on avatar upload error in user settings Signed-off-by: Julien Veyssier --- core/Controller/AvatarController.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'core/Controller') diff --git a/core/Controller/AvatarController.php b/core/Controller/AvatarController.php index 69ec2f4bffe..34815321495 100644 --- a/core/Controller/AvatarController.php +++ b/core/Controller/AvatarController.php @@ -193,8 +193,20 @@ class AvatarController extends Controller { $content = $this->cache->get('avatar_upload'); unlink($files['tmp_name'][0]); } else { + $phpFileUploadErrors = [ + UPLOAD_ERR_OK => $this->l->t('The file was uploaded'), + UPLOAD_ERR_INI_SIZE => $this->l->t('The uploaded file exceeds the upload_max_filesize directive in php.ini'), + UPLOAD_ERR_FORM_SIZE => $this->l->t('The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form'), + UPLOAD_ERR_PARTIAL => $this->l->t('The file was only partially uploaded'), + UPLOAD_ERR_NO_FILE => $this->l->t('No file was uploaded'), + UPLOAD_ERR_NO_TMP_DIR => $this->l->t('Missing a temporary folder'), + UPLOAD_ERR_CANT_WRITE => $this->l->t('Could not write file to disk'), + UPLOAD_ERR_EXTENSION => $this->l->t('A PHP extension stopped the file upload'), + ]; + $message = $phpFileUploadErrors[$files['error'][0]] ?? $this->l->t('Invalid file provided'); + $this->logger->warning($message, ['app' => 'core']); return new JSONResponse( - ['data' => ['message' => $this->l->t('Invalid file provided')]], + ['data' => ['message' => $message]], Http::STATUS_BAD_REQUEST ); } -- cgit v1.2.3 From c232a40bdf8c6cd0ed30ca93695c490157a5ee77 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 1 Apr 2021 13:51:53 +0200 Subject: remove leftover debug @NoCSRFRequired introduced with #26198 Signed-off-by: Robin Appelman --- core/Controller/SearchController.php | 1 - 1 file changed, 1 deletion(-) (limited to 'core/Controller') diff --git a/core/Controller/SearchController.php b/core/Controller/SearchController.php index 42439e9ceb9..72633630dad 100644 --- a/core/Controller/SearchController.php +++ b/core/Controller/SearchController.php @@ -55,7 +55,6 @@ class SearchController extends Controller { /** * @NoAdminRequired - * @NoCSRFRequired */ public function search(string $query, array $inApps = [], int $page = 1, int $size = 30): JSONResponse { $results = $this->searcher->searchPaged($query, $inApps, $page, $size); -- cgit v1.2.3 From 69290781ff0a59e72c1cf7c9c3b1c6a5ffc2596a Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 16 Apr 2021 11:03:12 +0200 Subject: Handle device login like an alternative login Signed-off-by: Joas Schilling --- core/Controller/LoginController.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'core/Controller') diff --git a/core/Controller/LoginController.php b/core/Controller/LoginController.php index e466f029ec1..b14b2e072b9 100644 --- a/core/Controller/LoginController.php +++ b/core/Controller/LoginController.php @@ -204,6 +204,9 @@ class LoginController extends Controller { $parameters = [ 'alt_login' => OC_App::getAlternativeLogIns(), ]; + + $this->initialStateService->provideInitialState('core', 'countAlternativeLogins', count($parameters['alt_login'])); + return new TemplateResponse( $this->appName, 'login', $parameters, 'guest' ); -- cgit v1.2.3 From f23d057ad92d77cbfeda9eed65a4874dc570761e Mon Sep 17 00:00:00 2001 From: Richard de Boer Date: Sat, 10 Apr 2021 14:49:13 +0200 Subject: Fix functions taking optional parameters before required ones PHP 8 shows deprecation warnings about this, see #25806 Removes the "default" values, as they actually are required parameters anyway. Signed-off-by: Richard de Boer --- core/Controller/PreviewController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'core/Controller') diff --git a/core/Controller/PreviewController.php b/core/Controller/PreviewController.php index 0b762094086..d46ecc6d157 100644 --- a/core/Controller/PreviewController.php +++ b/core/Controller/PreviewController.php @@ -156,8 +156,8 @@ class PreviewController extends Controller { Node $node, int $x, int $y, - bool $a = false, - bool $forceIcon = true, + bool $a, + bool $forceIcon, string $mode) : Http\Response { if (!($node instanceof File) || (!$forceIcon && !$this->preview->isAvailable($node))) { return new DataResponse([], Http::STATUS_NOT_FOUND); -- cgit v1.2.3 From 215aef3cbdc1963be1bb6bca5218ee0a4b7f1665 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Molakvo=C3=A6=20=28skjnldsv=29?= Date: Fri, 4 Jun 2021 21:52:51 +0200 Subject: Update php licenses MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ (skjnldsv) --- core/Controller/AppPasswordController.php | 4 ++-- core/Controller/AutoCompleteController.php | 5 ++--- core/Controller/AvatarController.php | 4 ++-- core/Controller/CSRFTokenController.php | 3 +-- core/Controller/ClientFlowLoginController.php | 3 +-- core/Controller/ClientFlowLoginV2Controller.php | 3 +-- core/Controller/CollaborationResourcesController.php | 3 +-- core/Controller/ContactsMenuController.php | 3 +-- core/Controller/CssController.php | 5 ++--- core/Controller/GuestAvatarController.php | 3 +-- core/Controller/JsController.php | 5 ++--- core/Controller/LoginController.php | 3 +-- core/Controller/LostController.php | 1 - core/Controller/NavigationController.php | 4 +--- core/Controller/OCJSController.php | 5 ++--- core/Controller/OCSController.php | 5 ++--- core/Controller/PreviewController.php | 3 +-- core/Controller/RecommendedAppsController.php | 3 +-- core/Controller/SearchController.php | 3 +-- core/Controller/SetupController.php | 1 - core/Controller/SvgController.php | 5 ++--- core/Controller/TwoFactorChallengeController.php | 1 - core/Controller/UnifiedSearchController.php | 5 ++--- core/Controller/UserController.php | 1 - core/Controller/WalledGardenController.php | 3 +-- core/Controller/WebAuthnController.php | 3 +-- core/Controller/WellKnownController.php | 3 +-- core/Controller/WhatsNewController.php | 3 +-- core/Controller/WipeController.php | 3 +-- 29 files changed, 34 insertions(+), 62 deletions(-) (limited to 'core/Controller') diff --git a/core/Controller/AppPasswordController.php b/core/Controller/AppPasswordController.php index 15f86b4ad6a..41f0f6e4f27 100644 --- a/core/Controller/AppPasswordController.php +++ b/core/Controller/AppPasswordController.php @@ -5,6 +5,7 @@ declare(strict_types=1); /** * @copyright Copyright (c) 2018, Roeland Jago Douma * + * @author Christoph Wurst * @author Daniel Kesselberg * @author Roeland Jago Douma * @@ -17,14 +18,13 @@ declare(strict_types=1); * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * */ - namespace OC\Core\Controller; use OC\Authentication\Events\AppPasswordCreatedEvent; diff --git a/core/Controller/AutoCompleteController.php b/core/Controller/AutoCompleteController.php index 74f5db485c8..6cbca91ec0f 100644 --- a/core/Controller/AutoCompleteController.php +++ b/core/Controller/AutoCompleteController.php @@ -8,7 +8,7 @@ declare(strict_types=1); * @author Arthur Schiwon * @author Christoph Wurst * @author Joas Schilling - * @author John Molakvoæ (skjnldsv) + * @author John Molakvoæ * @author Roeland Jago Douma * * @license GNU AGPL version 3 or any later version @@ -20,14 +20,13 @@ declare(strict_types=1); * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * */ - namespace OC\Core\Controller; use OCP\AppFramework\Http\DataResponse; diff --git a/core/Controller/AvatarController.php b/core/Controller/AvatarController.php index 34815321495..3b87bf15b2f 100644 --- a/core/Controller/AvatarController.php +++ b/core/Controller/AvatarController.php @@ -5,7 +5,8 @@ * @author Christoph Wurst * @author Daniel Kesselberg * @author Joas Schilling - * @author John Molakvoæ (skjnldsv) + * @author John Molakvoæ + * @author Julien Veyssier * @author Lukas Reschke * @author Morris Jobke * @author Roeland Jago Douma @@ -27,7 +28,6 @@ * along with this program. If not, see * */ - namespace OC\Core\Controller; use OC\AppFramework\Utility\TimeFactory; diff --git a/core/Controller/CSRFTokenController.php b/core/Controller/CSRFTokenController.php index 9ff389140bd..510d5e64d9f 100644 --- a/core/Controller/CSRFTokenController.php +++ b/core/Controller/CSRFTokenController.php @@ -17,14 +17,13 @@ declare(strict_types=1); * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * */ - namespace OC\Core\Controller; use OC\Security\CSRF\CsrfTokenManager; diff --git a/core/Controller/ClientFlowLoginController.php b/core/Controller/ClientFlowLoginController.php index b7599acc3c6..2ba26deb0e7 100644 --- a/core/Controller/ClientFlowLoginController.php +++ b/core/Controller/ClientFlowLoginController.php @@ -22,14 +22,13 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * */ - namespace OC\Core\Controller; use OC\Authentication\Events\AppPasswordCreatedEvent; diff --git a/core/Controller/ClientFlowLoginV2Controller.php b/core/Controller/ClientFlowLoginV2Controller.php index 103d659ecd2..205c1ff8a1c 100644 --- a/core/Controller/ClientFlowLoginV2Controller.php +++ b/core/Controller/ClientFlowLoginV2Controller.php @@ -18,14 +18,13 @@ declare(strict_types=1); * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * */ - namespace OC\Core\Controller; use OC\Core\Db\LoginFlowV2; diff --git a/core/Controller/CollaborationResourcesController.php b/core/Controller/CollaborationResourcesController.php index 72bcf351db0..114423e1a2f 100644 --- a/core/Controller/CollaborationResourcesController.php +++ b/core/Controller/CollaborationResourcesController.php @@ -18,14 +18,13 @@ declare(strict_types=1); * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * */ - namespace OC\Core\Controller; use Exception; diff --git a/core/Controller/ContactsMenuController.php b/core/Controller/ContactsMenuController.php index 8b7962f97ef..6c967e7e019 100644 --- a/core/Controller/ContactsMenuController.php +++ b/core/Controller/ContactsMenuController.php @@ -15,14 +15,13 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * */ - namespace OC\Core\Controller; use OC\Contacts\ContactsMenu\Manager; diff --git a/core/Controller/CssController.php b/core/Controller/CssController.php index 05c1bd5e6cf..e1d7d5178cd 100644 --- a/core/Controller/CssController.php +++ b/core/Controller/CssController.php @@ -7,7 +7,7 @@ declare(strict_types=1); * * @author Christoph Wurst * @author Joas Schilling - * @author John Molakvoæ (skjnldsv) + * @author John Molakvoæ * @author Morris Jobke * @author Roeland Jago Douma * @author Thomas Citharel @@ -21,14 +21,13 @@ declare(strict_types=1); * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * */ - namespace OC\Core\Controller; use OC\Files\AppData\Factory; diff --git a/core/Controller/GuestAvatarController.php b/core/Controller/GuestAvatarController.php index 38b5cfd2941..57900af810d 100644 --- a/core/Controller/GuestAvatarController.php +++ b/core/Controller/GuestAvatarController.php @@ -13,14 +13,13 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * */ - namespace OC\Core\Controller; use OCP\AppFramework\Controller; diff --git a/core/Controller/JsController.php b/core/Controller/JsController.php index 2adb0ac374d..937df073e81 100644 --- a/core/Controller/JsController.php +++ b/core/Controller/JsController.php @@ -7,7 +7,7 @@ declare(strict_types=1); * * @author Christoph Wurst * @author Joas Schilling - * @author John Molakvoæ (skjnldsv) + * @author John Molakvoæ * @author Morris Jobke * @author Roeland Jago Douma * @author Thomas Citharel @@ -21,14 +21,13 @@ declare(strict_types=1); * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * */ - namespace OC\Core\Controller; use OC\Files\AppData\Factory; diff --git a/core/Controller/LoginController.php b/core/Controller/LoginController.php index b14b2e072b9..8a96db97c9e 100644 --- a/core/Controller/LoginController.php +++ b/core/Controller/LoginController.php @@ -7,7 +7,7 @@ * @author Christoph Wurst * @author Daniel Kesselberg * @author Joas Schilling - * @author John Molakvoæ (skjnldsv) + * @author John Molakvoæ * @author Julius Härtl * @author Lukas Reschke * @author Michael Weimann @@ -29,7 +29,6 @@ * along with this program. If not, see * */ - namespace OC\Core\Controller; use OC\AppFramework\Http\Request; diff --git a/core/Controller/LostController.php b/core/Controller/LostController.php index eedb9eef542..99427132f5e 100644 --- a/core/Controller/LostController.php +++ b/core/Controller/LostController.php @@ -33,7 +33,6 @@ * along with this program. If not, see * */ - namespace OC\Core\Controller; use function array_filter; diff --git a/core/Controller/NavigationController.php b/core/Controller/NavigationController.php index ad88985ce76..9d0565145c3 100644 --- a/core/Controller/NavigationController.php +++ b/core/Controller/NavigationController.php @@ -3,7 +3,6 @@ * @copyright Copyright (c) 2018 Julius Härtl * * @author Julius Härtl - * @author Roeland Jago Douma * * @license GNU AGPL version 3 or any later version * @@ -14,14 +13,13 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * */ - namespace OC\Core\Controller; use OCP\AppFramework\Http; diff --git a/core/Controller/OCJSController.php b/core/Controller/OCJSController.php index c3a74733b98..71f0941b46c 100644 --- a/core/Controller/OCJSController.php +++ b/core/Controller/OCJSController.php @@ -4,7 +4,7 @@ * * @author Bjoern Schiessle * @author Joas Schilling - * @author John Molakvoæ (skjnldsv) + * @author John Molakvoæ * @author Lukas Reschke * @author Morris Jobke * @author Roeland Jago Douma @@ -18,14 +18,13 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * */ - namespace OC\Core\Controller; use bantu\IniGetWrapper\IniGetWrapper; diff --git a/core/Controller/OCSController.php b/core/Controller/OCSController.php index f3a65420bd7..63a25591ef0 100644 --- a/core/Controller/OCSController.php +++ b/core/Controller/OCSController.php @@ -1,6 +1,6 @@ * * @author Christoph Wurst * @author Daniel Kesselberg @@ -18,14 +18,13 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * */ - namespace OC\Core\Controller; use OC\CapabilitiesManager; diff --git a/core/Controller/PreviewController.php b/core/Controller/PreviewController.php index 0b762094086..e1bfa01b238 100644 --- a/core/Controller/PreviewController.php +++ b/core/Controller/PreviewController.php @@ -18,14 +18,13 @@ declare(strict_types=1); * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * */ - namespace OC\Core\Controller; use OCP\AppFramework\Controller; diff --git a/core/Controller/RecommendedAppsController.php b/core/Controller/RecommendedAppsController.php index 6240aecf43c..1b6650ed902 100644 --- a/core/Controller/RecommendedAppsController.php +++ b/core/Controller/RecommendedAppsController.php @@ -16,14 +16,13 @@ declare(strict_types=1); * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * */ - namespace OC\Core\Controller; use OCP\AppFramework\Controller; diff --git a/core/Controller/SearchController.php b/core/Controller/SearchController.php index 72633630dad..95d100a393d 100644 --- a/core/Controller/SearchController.php +++ b/core/Controller/SearchController.php @@ -17,14 +17,13 @@ declare(strict_types=1); * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * */ - namespace OC\Core\Controller; use OCP\AppFramework\Controller; diff --git a/core/Controller/SetupController.php b/core/Controller/SetupController.php index 6d117eafd59..704a2507b5a 100644 --- a/core/Controller/SetupController.php +++ b/core/Controller/SetupController.php @@ -29,7 +29,6 @@ * along with this program. If not, see * */ - namespace OC\Core\Controller; use OC\Setup; diff --git a/core/Controller/SvgController.php b/core/Controller/SvgController.php index ff0a21ba516..ea73ba118d9 100644 --- a/core/Controller/SvgController.php +++ b/core/Controller/SvgController.php @@ -8,7 +8,7 @@ declare(strict_types=1); * @author Christoph Wurst * @author Daniel Kesselberg * @author Joas Schilling - * @author John Molakvoæ (skjnldsv) + * @author John Molakvoæ * @author Julius Härtl * @author Roeland Jago Douma * @author Thomas Citharel @@ -22,14 +22,13 @@ declare(strict_types=1); * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * */ - namespace OC\Core\Controller; use OC\Template\IconsCacher; diff --git a/core/Controller/TwoFactorChallengeController.php b/core/Controller/TwoFactorChallengeController.php index a9e1ee35917..e08454caea6 100644 --- a/core/Controller/TwoFactorChallengeController.php +++ b/core/Controller/TwoFactorChallengeController.php @@ -23,7 +23,6 @@ * along with this program. If not, see * */ - namespace OC\Core\Controller; use OC\Authentication\TwoFactorAuth\Manager; diff --git a/core/Controller/UnifiedSearchController.php b/core/Controller/UnifiedSearchController.php index c2949ce6095..93fbb323ee5 100644 --- a/core/Controller/UnifiedSearchController.php +++ b/core/Controller/UnifiedSearchController.php @@ -7,7 +7,7 @@ declare(strict_types=1); * * @author Christoph Wurst * @author Joas Schilling - * @author John Molakvoæ (skjnldsv) + * @author John Molakvoæ * * @license GNU AGPL version 3 or any later version * @@ -18,14 +18,13 @@ declare(strict_types=1); * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * */ - namespace OC\Core\Controller; use OC\Search\SearchComposer; diff --git a/core/Controller/UserController.php b/core/Controller/UserController.php index 638e4e00e46..6d50348c2a5 100644 --- a/core/Controller/UserController.php +++ b/core/Controller/UserController.php @@ -22,7 +22,6 @@ * along with this program. If not, see * */ - namespace OC\Core\Controller; use OCP\AppFramework\Controller; diff --git a/core/Controller/WalledGardenController.php b/core/Controller/WalledGardenController.php index 208162c754e..4aff72beb44 100644 --- a/core/Controller/WalledGardenController.php +++ b/core/Controller/WalledGardenController.php @@ -14,14 +14,13 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * */ - namespace OC\Core\Controller; use OCP\AppFramework\Controller; diff --git a/core/Controller/WebAuthnController.php b/core/Controller/WebAuthnController.php index b602fe4c728..1aab505f16a 100644 --- a/core/Controller/WebAuthnController.php +++ b/core/Controller/WebAuthnController.php @@ -17,14 +17,13 @@ declare(strict_types=1); * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * */ - namespace OC\Core\Controller; use OC\Authentication\Login\LoginData; diff --git a/core/Controller/WellKnownController.php b/core/Controller/WellKnownController.php index 640aa33f49f..12384b6f9ad 100644 --- a/core/Controller/WellKnownController.php +++ b/core/Controller/WellKnownController.php @@ -16,14 +16,13 @@ declare(strict_types=1); * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * */ - namespace OC\Core\Controller; use OC\Http\WellKnown\RequestManager; diff --git a/core/Controller/WhatsNewController.php b/core/Controller/WhatsNewController.php index 48cd26a1b59..f316c62c973 100644 --- a/core/Controller/WhatsNewController.php +++ b/core/Controller/WhatsNewController.php @@ -14,14 +14,13 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * */ - namespace OC\Core\Controller; use OC\CapabilitiesManager; diff --git a/core/Controller/WipeController.php b/core/Controller/WipeController.php index bc3cc7ba063..5eef03b129f 100644 --- a/core/Controller/WipeController.php +++ b/core/Controller/WipeController.php @@ -16,14 +16,13 @@ declare(strict_types=1); * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * */ - namespace OC\Core\Controller; use OC\Authentication\Exceptions\InvalidTokenException; -- cgit v1.2.3 From c0474ba3644fc94674788bf21dd3e22d564e019c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Fri, 5 Mar 2021 10:04:09 +0100 Subject: Use product name in places where it is appropriate rather than the instance name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- core/Controller/WhatsNewController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core/Controller') diff --git a/core/Controller/WhatsNewController.php b/core/Controller/WhatsNewController.php index f316c62c973..12024dec030 100644 --- a/core/Controller/WhatsNewController.php +++ b/core/Controller/WhatsNewController.php @@ -89,7 +89,7 @@ class WhatsNewController extends OCSController { $whatsNew = $this->whatsNewService->getChangesForVersion($currentVersion); $resultData = [ 'changelogURL' => $whatsNew['changelogURL'], - 'product' => $this->defaults->getName(), + 'product' => $this->defaults->getProductName(), 'version' => $currentVersion, ]; do { -- cgit v1.2.3