diff options
Diffstat (limited to 'apps/dav/lib/Controller/InvitationResponseController.php')
-rw-r--r-- | apps/dav/lib/Controller/InvitationResponseController.php | 70 |
1 files changed, 20 insertions, 50 deletions
diff --git a/apps/dav/lib/Controller/InvitationResponseController.php b/apps/dav/lib/Controller/InvitationResponseController.php index 4a32966220f..19eb4097b45 100644 --- a/apps/dav/lib/Controller/InvitationResponseController.php +++ b/apps/dav/lib/Controller/InvitationResponseController.php @@ -3,34 +3,16 @@ declare(strict_types=1); /** - * @copyright 2018, Georg Ehrke <oc.list@georgehrke.com> - * - * @author Christoph Wurst <christoph@winzerhof-wurst.at> - * @author Georg Ehrke <oc.list@georgehrke.com> - * @author Joas Schilling <coding@schilljs.com> - * @author Kate Döen <kate.doeen@nextcloud.com> - * - * @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 <http://www.gnu.org/licenses/>. - * + * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later */ namespace OCA\DAV\Controller; use OCA\DAV\CalDAV\InvitationResponse\InvitationResponseServer; use OCP\AppFramework\Controller; +use OCP\AppFramework\Http\Attribute\NoCSRFRequired; use OCP\AppFramework\Http\Attribute\OpenAPI; +use OCP\AppFramework\Http\Attribute\PublicPage; use OCP\AppFramework\Http\TemplateResponse; use OCP\AppFramework\Utility\ITimeFactory; use OCP\IDBConnection; @@ -41,15 +23,6 @@ use Sabre\VObject\Reader; #[OpenAPI(scope: OpenAPI::SCOPE_IGNORE)] class InvitationResponseController extends Controller { - /** @var IDBConnection */ - private $db; - - /** @var ITimeFactory */ - private $timeFactory; - - /** @var InvitationResponseServer */ - private $responseServer; - /** * InvitationResponseController constructor. * @@ -59,25 +32,25 @@ class InvitationResponseController extends Controller { * @param ITimeFactory $timeFactory * @param InvitationResponseServer $responseServer */ - public function __construct(string $appName, IRequest $request, - IDBConnection $db, ITimeFactory $timeFactory, - InvitationResponseServer $responseServer) { + public function __construct( + string $appName, + IRequest $request, + private IDBConnection $db, + private ITimeFactory $timeFactory, + private InvitationResponseServer $responseServer, + ) { parent::__construct($appName, $request); - $this->db = $db; - $this->timeFactory = $timeFactory; - $this->responseServer = $responseServer; // Don't run `$server->exec()`, because we just need access to the // fully initialized schedule plugin, but we don't want Sabre/DAV // to actually handle and reply to the request } /** - * @PublicPage - * @NoCSRFRequired - * * @param string $token * @return TemplateResponse */ + #[PublicPage] + #[NoCSRFRequired] public function accept(string $token):TemplateResponse { $row = $this->getTokenInformation($token); if (!$row) { @@ -96,12 +69,11 @@ class InvitationResponseController extends Controller { } /** - * @PublicPage - * @NoCSRFRequired - * * @param string $token * @return TemplateResponse */ + #[PublicPage] + #[NoCSRFRequired] public function decline(string $token):TemplateResponse { $row = $this->getTokenInformation($token); if (!$row) { @@ -121,12 +93,11 @@ class InvitationResponseController extends Controller { } /** - * @PublicPage - * @NoCSRFRequired - * * @param string $token * @return TemplateResponse */ + #[PublicPage] + #[NoCSRFRequired] public function options(string $token):TemplateResponse { return new TemplateResponse($this->appName, 'schedule-response-options', [ 'token' => $token @@ -134,13 +105,12 @@ class InvitationResponseController extends Controller { } /** - * @PublicPage - * @NoCSRFRequired - * * @param string $token * * @return TemplateResponse */ + #[PublicPage] + #[NoCSRFRequired] public function processMoreOptionsResult(string $token):TemplateResponse { $partstat = $this->request->getParam('partStat'); @@ -178,7 +148,7 @@ class InvitationResponseController extends Controller { } $currentTime = $this->timeFactory->getTime(); - if (((int) $row['expiration']) < $currentTime) { + if (((int)$row['expiration']) < $currentTime) { return null; } |