From da5d7837d69a7018284d1b4f60019cfb2a85ca1e Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Wed, 11 Sep 2024 08:56:54 +0200 Subject: [PATCH 1/4] refactor: Use Nextcloud sets for rector Signed-off-by: Christoph Wurst --- rector.php | 6 ++-- templates/index.php | 2 +- templates/oauth_done.php | 2 +- templates/redirect.php | 2 +- templates/settings-admin.php | 2 +- vendor-bin/rector/composer.json | 2 +- vendor-bin/rector/composer.lock | 64 ++++++++++++++++++++++++++++++++- 7 files changed, 72 insertions(+), 8 deletions(-) diff --git a/rector.php b/rector.php index bc26c763f2..af32da3e0f 100644 --- a/rector.php +++ b/rector.php @@ -12,6 +12,7 @@ return RectorConfig::configure() ->withPaths([ __DIR__ . '/lib', + __DIR__ . '/templates', __DIR__ . '/tests', ]) ->withSkip([ @@ -24,6 +25,7 @@ ->withBootstrapFiles([ __DIR__ . '/../../lib/composer/autoload.php', ]) - ->withRules([ - \ChristophWurst\Nextcloud\Rector\Rector\OcServerToOcpServerRector::class, + ->withSets([ + \ChristophWurst\Nextcloud\Rector\Set\NextcloudSets::NEXTCLOUD_ALL, + \ChristophWurst\Nextcloud\Rector\Set\NextcloudSets::NEXTCLOUD_25, ]); diff --git a/templates/index.php b/templates/index.php index e5ea418de2..98205ff6b6 100644 --- a/templates/index.php +++ b/templates/index.php @@ -4,7 +4,7 @@ * SPDX-FileCopyrightText: 2013-2016 ownCloud, Inc. * SPDX-License-Identifier: AGPL-3.0-only */ -script('mail', 'mail'); +\OCP\Util::addScript('mail', 'mail', 'core'); ?> diff --git a/templates/oauth_done.php b/templates/oauth_done.php index fe0e6d2d5a..d98deabc28 100644 --- a/templates/oauth_done.php +++ b/templates/oauth_done.php @@ -7,7 +7,7 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -script(\OCA\Mail\AppInfo\Application::APP_ID, 'oauthpopup'); +\OCP\Util::addScript(\OCA\Mail\AppInfo\Application::APP_ID, 'oauthpopup', 'core'); ?> diff --git a/templates/redirect.php b/templates/redirect.php index 0ec4378929..ab9b66fc26 100644 --- a/templates/redirect.php +++ b/templates/redirect.php @@ -8,7 +8,7 @@ ?> - +
diff --git a/templates/settings-admin.php b/templates/settings-admin.php index 3366c5d6ce..8586591527 100644 --- a/templates/settings-admin.php +++ b/templates/settings-admin.php @@ -5,7 +5,7 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -script(\OCA\Mail\AppInfo\Application::APP_ID, 'settings'); +\OCP\Util::addScript(\OCA\Mail\AppInfo\Application::APP_ID, 'settings', 'core'); ?>
diff --git a/vendor-bin/rector/composer.json b/vendor-bin/rector/composer.json index 2e102f92a6..aef382c009 100644 --- a/vendor-bin/rector/composer.json +++ b/vendor-bin/rector/composer.json @@ -3,7 +3,7 @@ "sort-packages": true }, "require-dev": { - "christophwurst/nextcloud-rector": "^0.0.4", + "christophwurst/nextcloud-rector": "^0.1.2", "rector/rector": "^1.2.4" } } diff --git a/vendor-bin/rector/composer.lock b/vendor-bin/rector/composer.lock index e072ff0927..aaf55d5f07 100644 --- a/vendor-bin/rector/composer.lock +++ b/vendor-bin/rector/composer.lock @@ -4,9 +4,71 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "715b06042960e760e5d2728bfce23b1b", + "content-hash": "38703a9b83f7e93c63b6f814e2d0b25b", "packages": [], "packages-dev": [ + { + "name": "christophwurst/nextcloud-rector", + "version": "v0.1.2", + "source": { + "type": "git", + "url": "https://github.com/ChristophWurst/nextcloud-rector.git", + "reference": "f98c2d8bd13654a6c27ea0d9788949e90912f800" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ChristophWurst/nextcloud-rector/zipball/f98c2d8bd13654a6c27ea0d9788949e90912f800", + "reference": "f98c2d8bd13654a6c27ea0d9788949e90912f800", + "shasum": "" + }, + "require": { + "php": "^8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.5", + "ramsey/devtools": "^2.0", + "rector/rector": "^1.2" + }, + "type": "library", + "extra": { + "captainhook": { + "force-install": true + }, + "ramsey/conventional-commits": { + "configFile": "conventional-commits.json" + }, + "ramsey/devtools": { + "command-prefix": "dev", + "memory-limit": "-1" + } + }, + "autoload": { + "psr-4": { + "ChristophWurst\\Nextcloud\\Rector\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "AGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Christoph Wurst", + "email": "christoph@winzerhof-wurst.at", + "homepage": "https://wuc.me" + } + ], + "description": "Rector upgrade rules for Nextcloud", + "keywords": [ + "nextcloud", + "refactoring" + ], + "support": { + "issues": "https://github.com/ChristophWurst/nextcloud-rector/issues", + "source": "https://github.com/ChristophWurst/nextcloud-rector/tree/v0.1.2" + }, + "time": "2024-09-11T06:54:05+00:00" + }, { "name": "phpstan/phpstan", "version": "1.11.11", From d65b14afb63d4dc9f884f198ae8a39854862e50d Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Wed, 11 Sep 2024 10:17:16 +0200 Subject: [PATCH 2/4] fixup! refactor: Use Nextcloud sets for rector Signed-off-by: Christoph Wurst --- lib/Controller/AccountsController.php | 30 ++++------ lib/Controller/AliasesController.php | 17 +++--- lib/Controller/AutoCompleteController.php | 4 +- lib/Controller/AutoConfigController.php | 10 ++-- lib/Controller/AvatarsController.php | 12 ++-- .../ContactIntegrationController.php | 11 ++-- lib/Controller/DraftsController.php | 9 +-- .../GoogleIntegrationController.php | 6 +- lib/Controller/InternalAddressController.php | 7 +-- lib/Controller/ListController.php | 3 +- lib/Controller/LocalAttachmentsController.php | 4 +- lib/Controller/MailboxesController.php | 27 ++++----- lib/Controller/MessagesController.php | 59 +++++++++---------- .../MicrosoftIntegrationController.php | 6 +- lib/Controller/OutOfOfficeController.php | 16 ++--- lib/Controller/OutboxController.php | 17 +++--- lib/Controller/PageController.php | 46 ++++++++------- lib/Controller/PreferencesController.php | 5 +- lib/Controller/ProxyController.php | 11 ++-- lib/Controller/SieveController.php | 7 ++- .../SmimeCertificatesController.php | 8 +-- lib/Controller/TagsController.php | 8 +-- lib/Controller/ThreadController.php | 16 +++-- lib/Controller/TrustedSendersController.php | 8 +-- rector.php | 2 + vendor-bin/rector/composer.json | 2 +- vendor-bin/rector/composer.lock | 14 ++--- 27 files changed, 177 insertions(+), 188 deletions(-) diff --git a/lib/Controller/AccountsController.php b/lib/Controller/AccountsController.php index 6b8bd41f24..ff664d046f 100644 --- a/lib/Controller/AccountsController.php +++ b/lib/Controller/AccountsController.php @@ -28,6 +28,7 @@ use OCA\Mail\Service\Sync\SyncService; use OCP\AppFramework\Controller; use OCP\AppFramework\Http; +use OCP\AppFramework\Http\Attribute\NoAdminRequired; use OCP\AppFramework\Http\Attribute\OpenAPI; use OCP\AppFramework\Http\JSONResponse; use OCP\IConfig; @@ -82,11 +83,10 @@ public function __construct(string $appName, } /** - * @NoAdminRequired - * * @return JSONResponse */ #[TrapError] + #[NoAdminRequired] public function index(): JSONResponse { $mailAccounts = $this->accountService->findByUserId($this->currentUserId); @@ -100,7 +100,6 @@ public function index(): JSONResponse { } /** - * @NoAdminRequired * * @param int $id * @@ -108,12 +107,12 @@ public function index(): JSONResponse { * @throws ClientException */ #[TrapError] + #[NoAdminRequired] public function show(int $id): JSONResponse { return new JSONResponse($this->accountService->find($this->currentUserId, $id)); } /** - * @NoAdminRequired * * @param int $id * @param string $accountName @@ -134,6 +133,7 @@ public function show(int $id): JSONResponse { * @throws ClientException */ #[TrapError] + #[NoAdminRequired] public function update(int $id, string $accountName, string $emailAddress, @@ -198,7 +198,6 @@ public function update(int $id, } /** - * @NoAdminRequired * * @param int $id * @param string|null $editorMode @@ -212,10 +211,10 @@ public function update(int $id, * @param bool|null $signatureAboveQuote * * @return JSONResponse - * * @throws ClientException */ #[TrapError] + #[NoAdminRequired] public function patchAccount(int $id, ?string $editorMode = null, ?int $order = null, @@ -282,7 +281,6 @@ public function patchAccount(int $id, } /** - * @NoAdminRequired * * @param int $id * @param string|null $signature @@ -293,28 +291,27 @@ public function patchAccount(int $id, * @throws ServiceException */ #[TrapError] + #[NoAdminRequired] public function updateSignature(int $id, ?string $signature = null): JSONResponse { $this->accountService->updateSignature($id, $this->currentUserId, $signature); return new JSONResponse(); } /** - * @NoAdminRequired * * @param int $id * * @return JSONResponse - * * @throws ClientException */ #[TrapError] + #[NoAdminRequired] public function destroy(int $id): JSONResponse { $this->accountService->delete($this->currentUserId, $id); return new JSONResponse(); } /** - * @NoAdminRequired * * @param string $accountName * @param string $emailAddress @@ -329,10 +326,10 @@ public function destroy(int $id): JSONResponse { * @param string|null $smtpUser * @param string|null $smtpPassword * @param string $authMethod - * * @return JSONResponse */ #[TrapError] + #[NoAdminRequired] public function create(string $accountName, string $emailAddress, ?string $imapHost = null, @@ -403,13 +400,12 @@ public function create(string $accountName, } /** - * @NoAdminRequired * * @return JSONResponse - * * @throws ClientException */ #[TrapError] + #[NoAdminRequired] public function draft(int $id, string $subject, string $body, @@ -456,13 +452,13 @@ public function draft(int $id, } /** - * @NoAdminRequired * * @param int $id * * @return JSONResponse * @throws ClientException */ + #[NoAdminRequired] public function getQuota(int $id): JSONResponse { $account = $this->accountService->find($this->currentUserId, $id); @@ -474,14 +470,13 @@ public function getQuota(int $id): JSONResponse { } /** - * @NoAdminRequired * * @param int $id Account id * @param ?int $smimeCertificateId * @return JSONResponse - * * @throws ClientException */ + #[NoAdminRequired] public function updateSmimeCertificate(int $id, ?int $smimeCertificateId = null) { $account = $this->accountService->find($this->currentUserId, $id)->getMailAccount(); $account->setSmimeCertificateId($smimeCertificateId); @@ -490,13 +485,12 @@ public function updateSmimeCertificate(int $id, ?int $smimeCertificateId = null) } /** - * @NoAdminRequired * * @param int $id Account id * @return JSONResponse - * * @throws ClientException */ + #[NoAdminRequired] public function testAccountConnection(int $id) { return new JSONResponse([ 'data' => $this->accountService->testAccountConnection($this->currentUserId, $id), diff --git a/lib/Controller/AliasesController.php b/lib/Controller/AliasesController.php index 5e78014a5f..3493d3f662 100644 --- a/lib/Controller/AliasesController.php +++ b/lib/Controller/AliasesController.php @@ -15,6 +15,7 @@ use OCP\AppFramework\Controller; use OCP\AppFramework\Db\DoesNotExistException; use OCP\AppFramework\Http; +use OCP\AppFramework\Http\Attribute\NoAdminRequired; use OCP\AppFramework\Http\Attribute\OpenAPI; use OCP\AppFramework\Http\JSONResponse; use OCP\IRequest; @@ -34,32 +35,28 @@ public function __construct(string $appName, } /** - * @NoAdminRequired * * @param int $accountId - * * @return JSONResponse */ #[TrapError] + #[NoAdminRequired] public function index(int $accountId): JSONResponse { return new JSONResponse($this->aliasService->findAll($accountId, $this->currentUserId)); } /** - * @NoAdminRequired - * * * @return never */ #[TrapError] + #[NoAdminRequired] public function show() { throw new NotImplemented(); } - /** - * @NoAdminRequired - */ #[TrapError] + #[NoAdminRequired] public function update(int $id, string $alias, string $aliasName, @@ -76,18 +73,17 @@ public function update(int $id, } /** - * @NoAdminRequired * * @param int $id * @return JSONResponse */ #[TrapError] + #[NoAdminRequired] public function destroy(int $id): JSONResponse { return new JSONResponse($this->aliasService->delete($this->currentUserId, $id)); } /** - * @NoAdminRequired * * @param int $accountId * @param string $alias @@ -97,6 +93,7 @@ public function destroy(int $id): JSONResponse { * @throws DoesNotExistException */ #[TrapError] + #[NoAdminRequired] public function create(int $accountId, string $alias, string $aliasName): JSONResponse { return new JSONResponse( $this->aliasService->create($this->currentUserId, $accountId, $alias, $aliasName), @@ -105,7 +102,6 @@ public function create(int $accountId, string $alias, string $aliasName): JSONRe } /** - * @NoAdminRequired * * @param int $id * @param string|null $signature @@ -114,6 +110,7 @@ public function create(int $accountId, string $alias, string $aliasName): JSONRe * @throws DoesNotExistException */ #[TrapError] + #[NoAdminRequired] public function updateSignature(int $id, ?string $signature = null): JSONResponse { return new JSONResponse($this->aliasService->updateSignature($this->currentUserId, $id, $signature)); } diff --git a/lib/Controller/AutoCompleteController.php b/lib/Controller/AutoCompleteController.php index 1f367b1856..696e505016 100644 --- a/lib/Controller/AutoCompleteController.php +++ b/lib/Controller/AutoCompleteController.php @@ -13,6 +13,7 @@ use OCA\Mail\Http\TrapError; use OCA\Mail\Service\AutoCompletion\AutoCompleteService; use OCP\AppFramework\Controller; +use OCP\AppFramework\Http\Attribute\NoAdminRequired; use OCP\AppFramework\Http\Attribute\OpenAPI; use OCP\AppFramework\Http\JSONResponse; use OCP\IRequest; @@ -33,13 +34,12 @@ public function __construct(string $appName, } /** - * @NoAdminRequired * * @param string $term - * * @return JSONResponse */ #[TrapError] + #[NoAdminRequired] public function index(string $term): JSONResponse { if ($this->userId === null) { return new JSONResponse([]); diff --git a/lib/Controller/AutoConfigController.php b/lib/Controller/AutoConfigController.php index dbcaee5f65..e71d4b149b 100644 --- a/lib/Controller/AutoConfigController.php +++ b/lib/Controller/AutoConfigController.php @@ -18,6 +18,7 @@ use OCA\Mail\Service\AutoConfig\MxRecord; use OCP\AppFramework\Controller; use OCP\AppFramework\Http; +use OCP\AppFramework\Http\Attribute\NoAdminRequired; use OCP\AppFramework\Http\Attribute\OpenAPI; use OCP\AppFramework\Http\Attribute\UserRateLimit; use OCP\IRequest; @@ -46,13 +47,12 @@ public function __construct(IRequest $request, /** * @param string $email * - * @NoAdminRequired * @UserRateThrottle(limit=5, period=60) - * * @return JsonResponse */ #[TrapError] #[UserRateLimit(limit: 5, period: 60)] + #[NoAdminRequired] public function queryIspdb(string $host, string $email): JsonResponse { $rfc822Address = new Horde_Mail_Rfc822_Address($email); if (!$rfc822Address->valid || !$this->hostValidator->isValid($host)) { @@ -66,13 +66,12 @@ public function queryIspdb(string $host, string $email): JsonResponse { /** * @param string $email * - * @NoAdminRequired * @UserRateThrottle(limit=5, period=60) - * * @return JsonResponse */ #[TrapError] #[UserRateLimit(limit: 5, period: 60)] + #[NoAdminRequired] public function queryMx(string $email): JsonResponse { $rfc822Address = new Horde_Mail_Rfc822_Address($email); if (!$rfc822Address->valid || !$this->hostValidator->isValid($rfc822Address->host)) { @@ -88,13 +87,12 @@ public function queryMx(string $email): JsonResponse { * @param string $host * @param int $port * - * @NoAdminRequired * @UserRateThrottle(limit=30, period=60) - * * @return JsonResponse */ #[TrapError] #[UserRateLimit(limit: 30, period: 60)] + #[NoAdminRequired] public function testConnectivity(string $host, int $port): JsonResponse { if (!in_array($port, [143, 993, 465, 587])) { return JsonResponse::fail('Port not allowed'); diff --git a/lib/Controller/AvatarsController.php b/lib/Controller/AvatarsController.php index 4dc20790b6..b29c7d554f 100644 --- a/lib/Controller/AvatarsController.php +++ b/lib/Controller/AvatarsController.php @@ -14,6 +14,8 @@ use OCA\Mail\Http\TrapError; use OCP\AppFramework\Controller; use OCP\AppFramework\Http; +use OCP\AppFramework\Http\Attribute\NoAdminRequired; +use OCP\AppFramework\Http\Attribute\NoCSRFRequired; use OCP\AppFramework\Http\Attribute\OpenAPI; use OCP\AppFramework\Http\JSONResponse; use OCP\AppFramework\Http\Response; @@ -35,13 +37,12 @@ public function __construct(string $appName, } /** - * @NoAdminRequired - * @NoCSRFRequired - * * @param string $email * @return JSONResponse */ #[TrapError] + #[NoAdminRequired] + #[NoCSRFRequired] public function url(string $email): JSONResponse { if (empty($email)) { return new JSONResponse([], Http::STATUS_BAD_REQUEST); @@ -72,13 +73,12 @@ public function url(string $email): JSONResponse { } /** - * @NoAdminRequired - * @NoCSRFRequired - * * @param string $email * @return Response */ #[TrapError] + #[NoAdminRequired] + #[NoCSRFRequired] public function image(string $email): Response { if (empty($email)) { return new JSONResponse([], Http::STATUS_BAD_REQUEST); diff --git a/lib/Controller/ContactIntegrationController.php b/lib/Controller/ContactIntegrationController.php index 80c37bfaa4..a8eb70dc37 100644 --- a/lib/Controller/ContactIntegrationController.php +++ b/lib/Controller/ContactIntegrationController.php @@ -13,6 +13,7 @@ use OCA\Mail\Service\ContactIntegration\ContactIntegrationService; use OCP\AppFramework\Controller; use OCP\AppFramework\Http; +use OCP\AppFramework\Http\Attribute\NoAdminRequired; use OCP\AppFramework\Http\Attribute\OpenAPI; use OCP\AppFramework\Http\JSONResponse; use OCP\IRequest; @@ -30,24 +31,24 @@ public function __construct(string $appName, } /** - * @NoAdminRequired * * @param string $mail * @return JSONResponse */ #[TrapError] + #[NoAdminRequired] public function match(string $mail): JSONResponse { return (new JSONResponse($this->service->findMatches($mail)))->cacheFor(60 * 60, false, true); } /** - * @NoAdminRequired * * @param string $uid * @param string $mail * @return JSONResponse */ #[TrapError] + #[NoAdminRequired] public function addMail(?string $uid = null, ?string $mail = null): JSONResponse { $res = $this->service->addEMailToContact($uid, $mail); if ($res === null) { @@ -56,10 +57,8 @@ public function addMail(?string $uid = null, ?string $mail = null): JSONResponse return new JSONResponse($res); } - /** - * @NoAdminRequired - */ #[TrapError] + #[NoAdminRequired] public function newContact(?string $contactName = null, ?string $mail = null): JSONResponse { $res = $this->service->newContact($contactName, $mail); if ($res === null) { @@ -69,12 +68,12 @@ public function newContact(?string $contactName = null, ?string $mail = null): J } /** - * @NoAdminRequired * * @param string $term * @return JSONResponse */ #[TrapError] + #[NoAdminRequired] public function autoComplete(string $term): JSONResponse { $res = $this->service->autoComplete($term); return (new JSONResponse($res))->cacheFor(60 * 60, false, true); diff --git a/lib/Controller/DraftsController.php b/lib/Controller/DraftsController.php index 4da921d886..e484bcb445 100644 --- a/lib/Controller/DraftsController.php +++ b/lib/Controller/DraftsController.php @@ -19,6 +19,7 @@ use OCP\AppFramework\Controller; use OCP\AppFramework\Db\DoesNotExistException; use OCP\AppFramework\Http; +use OCP\AppFramework\Http\Attribute\NoAdminRequired; use OCP\AppFramework\Http\Attribute\OpenAPI; use OCP\AppFramework\Utility\ITimeFactory; use OCP\IRequest; @@ -48,7 +49,6 @@ public function __construct(string $appName, } /** - * @NoAdminRequired * * @param int $accountId * @param string $subject @@ -72,6 +72,7 @@ public function __construct(string $appName, * @throws ClientException */ #[TrapError] + #[NoAdminRequired] public function create( int $accountId, string $subject, @@ -120,7 +121,6 @@ public function create( } /** - * @NoAdminRequired * * @param int $id * @param int $accountId @@ -139,6 +139,7 @@ public function create( * @return JsonResponse */ #[TrapError] + #[NoAdminRequired] public function update(int $id, int $accountId, string $subject, @@ -185,12 +186,12 @@ public function update(int $id, } /** - * @NoAdminRequired * * @param int $id * @return JsonResponse */ #[TrapError] + #[NoAdminRequired] public function destroy(int $id): JsonResponse { $message = $this->service->getMessage($id, $this->userId); $this->accountService->find($this->userId, $message->getAccountId()); @@ -200,12 +201,12 @@ public function destroy(int $id): JsonResponse { } /** - * @NoAdminRequired * * @param int $id * @return JsonResponse */ #[TrapError] + #[NoAdminRequired] public function move(int $id): JsonResponse { $message = $this->service->getMessage($id, $this->userId); $account = $this->accountService->find($this->userId, $message->getAccountId()); diff --git a/lib/Controller/GoogleIntegrationController.php b/lib/Controller/GoogleIntegrationController.php index b61536e6f5..b5aee976a2 100644 --- a/lib/Controller/GoogleIntegrationController.php +++ b/lib/Controller/GoogleIntegrationController.php @@ -18,6 +18,8 @@ use OCA\Mail\Service\AccountService; use OCP\AppFramework\Controller; use OCP\AppFramework\Http; +use OCP\AppFramework\Http\Attribute\NoAdminRequired; +use OCP\AppFramework\Http\Attribute\NoCSRFRequired; use OCP\AppFramework\Http\Attribute\OpenAPI; use OCP\AppFramework\Http\Response; use OCP\AppFramework\Http\StandaloneTemplateResponse; @@ -82,11 +84,11 @@ public function unlink(): JsonResponse { } /** - * @NoAdminRequired - * @NoCSRFRequired * * @return Response */ + #[NoAdminRequired] + #[NoCSRFRequired] public function oauthRedirect(?string $code, ?string $state, ?string $scope, ?string $error): Response { if ($this->userId === null) { // TODO: redirect to main nextcloud page diff --git a/lib/Controller/InternalAddressController.php b/lib/Controller/InternalAddressController.php index dab6fb930b..a4fc1c29d9 100644 --- a/lib/Controller/InternalAddressController.php +++ b/lib/Controller/InternalAddressController.php @@ -31,13 +31,13 @@ public function __construct(IRequest $request, } /** - * @NoAdminRequired * * @param string $address * @param string $type * @return JsonResponse */ #[TrapError] + #[NoAdminRequired] public function setAddress(string $address, string $type): JsonResponse { $address = $this->internalAddressService->add( $this->uid, @@ -49,13 +49,13 @@ public function setAddress(string $address, string $type): JsonResponse { } /** - * @NoAdminRequired * * @param string $address * @param string $type * @return JsonResponse */ #[TrapError] + #[NoAdminRequired] public function removeAddress(string $address, string $type): JsonResponse { if($this->uid === null) { return JsonResponse::error('User not found', Http::STATUS_UNAUTHORIZED); @@ -72,11 +72,10 @@ public function removeAddress(string $address, string $type): JsonResponse { } /** - * @NoAdminRequired - * * @return JsonResponse */ #[TrapError] + #[NoAdminRequired] public function list(): JsonResponse { if($this->uid === null) { return JsonResponse::error('User not found', Http::STATUS_UNAUTHORIZED); diff --git a/lib/Controller/ListController.php b/lib/Controller/ListController.php index cf3c72f903..593f3125d2 100644 --- a/lib/Controller/ListController.php +++ b/lib/Controller/ListController.php @@ -18,6 +18,7 @@ use OCP\AppFramework\Controller; use OCP\AppFramework\Db\DoesNotExistException; use OCP\AppFramework\Http; +use OCP\AppFramework\Http\Attribute\NoAdminRequired; use OCP\AppFramework\Http\Attribute\OpenAPI; use OCP\Http\Client\IClientService; use OCP\IRequest; @@ -50,9 +51,9 @@ public function __construct(IRequest $request, } /** - * @NoAdminRequired * @UserRateThrottle(limit=10, period=3600) */ + #[NoAdminRequired] public function unsubscribe(int $id): JsonResponse { try { $message = $this->mailManager->getMessage($this->currentUserId, $id); diff --git a/lib/Controller/LocalAttachmentsController.php b/lib/Controller/LocalAttachmentsController.php index f4223404e5..73df3d9727 100644 --- a/lib/Controller/LocalAttachmentsController.php +++ b/lib/Controller/LocalAttachmentsController.php @@ -15,6 +15,7 @@ use OCA\Mail\Service\Attachment\UploadedFile; use OCP\AppFramework\Controller; use OCP\AppFramework\Http; +use OCP\AppFramework\Http\Attribute\NoAdminRequired; use OCP\AppFramework\Http\Attribute\OpenAPI; use OCP\AppFramework\Http\JSONResponse; use OCP\IRequest; @@ -38,11 +39,10 @@ public function __construct(string $appName, IRequest $request, } /** - * @NoAdminRequired - * * @return JSONResponse */ #[TrapError] + #[NoAdminRequired] public function create(): JSONResponse { $file = $this->request->getUploadedFile('attachment'); diff --git a/lib/Controller/MailboxesController.php b/lib/Controller/MailboxesController.php index e45cb49d4b..2fa36bc786 100644 --- a/lib/Controller/MailboxesController.php +++ b/lib/Controller/MailboxesController.php @@ -23,6 +23,7 @@ use OCA\Mail\Service\Sync\SyncService; use OCP\AppFramework\Controller; use OCP\AppFramework\Http; +use OCP\AppFramework\Http\Attribute\NoAdminRequired; use OCP\AppFramework\Http\Attribute\OpenAPI; use OCP\AppFramework\Http\JSONResponse; use OCP\IRequest; @@ -57,7 +58,6 @@ public function __construct(string $appName, } /** - * @NoAdminRequired * * @param int $accountId * @@ -67,6 +67,7 @@ public function __construct(string $appName, * @throws ServiceException */ #[TrapError] + #[NoAdminRequired] public function index(int $accountId): JSONResponse { $account = $this->accountService->find($this->currentUserId, $accountId); @@ -80,14 +81,13 @@ public function index(int $accountId): JSONResponse { } /** - * @NoAdminRequired * * @param int $id * @param string $name - * * @return JSONResponse */ #[TrapError] + #[NoAdminRequired] public function patch(int $id, ?string $name = null, ?bool $subscribed = null, @@ -120,7 +120,6 @@ public function patch(int $id, } /** - * @NoAdminRequired * * @param int $id * @param int[] $ids @@ -133,6 +132,7 @@ public function patch(int $id, * @throws ServiceException */ #[TrapError] + #[NoAdminRequired] public function sync(int $id, array $ids = [], ?int $lastMessageTimestamp = null, bool $init = false, string $sortOrder = 'newest', ?string $query = null): JSONResponse { $mailbox = $this->mailManager->getMailbox($this->currentUserId, $id); $account = $this->accountService->find($this->currentUserId, $mailbox->getAccountId()); @@ -161,7 +161,6 @@ public function sync(int $id, array $ids = [], ?int $lastMessageTimestamp = null } /** - * @NoAdminRequired * * @param int $id * @@ -170,6 +169,7 @@ public function sync(int $id, array $ids = [], ?int $lastMessageTimestamp = null * @throws ServiceException */ #[TrapError] + #[NoAdminRequired] public function clearCache(int $id): JSONResponse { $mailbox = $this->mailManager->getMailbox($this->currentUserId, $id); $account = $this->accountService->find($this->currentUserId, $mailbox->getAccountId()); @@ -179,15 +179,14 @@ public function clearCache(int $id): JSONResponse { } /** - * @NoAdminRequired * * @param int $id * * @return JSONResponse - * * @throws ClientException */ #[TrapError] + #[NoAdminRequired] public function markAllAsRead(int $id): JSONResponse { $mailbox = $this->mailManager->getMailbox($this->currentUserId, $id); $account = $this->accountService->find($this->currentUserId, $mailbox->getAccountId()); @@ -198,7 +197,6 @@ public function markAllAsRead(int $id): JSONResponse { } /** - * @NoAdminRequired * * @param int $id * @@ -208,35 +206,33 @@ public function markAllAsRead(int $id): JSONResponse { * @throws ServiceException */ #[TrapError] + #[NoAdminRequired] public function stats(int $id): JSONResponse { $mailbox = $this->mailManager->getMailbox($this->currentUserId, $id); return new JSONResponse($mailbox->getStats()); } /** - * @NoAdminRequired - * * * @return never */ #[TrapError] + #[NoAdminRequired] public function show() { throw new NotImplemented(); } /** - * @NoAdminRequired - * * * @return never */ #[TrapError] + #[NoAdminRequired] public function update() { throw new NotImplemented(); } /** - * @NoAdminRequired * * * @return JSONResponse @@ -244,6 +240,7 @@ public function update() { * @throws ClientException */ #[TrapError] + #[NoAdminRequired] public function create(int $accountId, string $name): JSONResponse { $account = $this->accountService->find($this->currentUserId, $accountId); @@ -251,7 +248,6 @@ public function create(int $accountId, string $name): JSONResponse { } /** - * @NoAdminRequired * * @param int $id * @@ -260,6 +256,7 @@ public function create(int $accountId, string $name): JSONResponse { * @throws ServiceException */ #[TrapError] + #[NoAdminRequired] public function destroy(int $id): JSONResponse { $mailbox = $this->mailManager->getMailbox($this->currentUserId, $id); $account = $this->accountService->find($this->currentUserId, $mailbox->getAccountId()); @@ -269,7 +266,6 @@ public function destroy(int $id): JSONResponse { } /** - * @NoAdminRequired * * @param int $id * @@ -279,6 +275,7 @@ public function destroy(int $id): JSONResponse { * @throws \OCP\AppFramework\Db\DoesNotExistException */ #[TrapError] + #[NoAdminRequired] public function clearMailbox(int $id): JSONResponse { $mailbox = $this->mailManager->getMailbox($this->currentUserId, $id); $account = $this->accountService->find($this->currentUserId, $mailbox->getAccountId()); diff --git a/lib/Controller/MessagesController.php b/lib/Controller/MessagesController.php index 7ee51858be..fbfd49529a 100755 --- a/lib/Controller/MessagesController.php +++ b/lib/Controller/MessagesController.php @@ -35,6 +35,8 @@ use OCP\AppFramework\Controller; use OCP\AppFramework\Db\DoesNotExistException; use OCP\AppFramework\Http; +use OCP\AppFramework\Http\Attribute\NoAdminRequired; +use OCP\AppFramework\Http\Attribute\NoCSRFRequired; use OCP\AppFramework\Http\Attribute\OpenAPI; use OCP\AppFramework\Http\ContentSecurityPolicy; use OCP\AppFramework\Http\JSONResponse; @@ -118,7 +120,6 @@ public function __construct(string $appName, } /** - * @NoAdminRequired * * @param int $mailboxId * @param int $cursor @@ -131,6 +132,7 @@ public function __construct(string $appName, * @throws ServiceException */ #[TrapError] + #[NoAdminRequired] public function index(int $mailboxId, ?int $cursor = null, ?string $filter = null, @@ -158,7 +160,6 @@ public function index(int $mailboxId, } /** - * @NoAdminRequired * * @param int $id * @@ -166,6 +167,7 @@ public function index(int $mailboxId, * @throws ServiceException */ #[TrapError] + #[NoAdminRequired] public function show(int $id): JSONResponse { try { $message = $this->mailManager->getMessage($this->currentUserId, $id); @@ -187,7 +189,6 @@ public function show(int $id): JSONResponse { } /** - * @NoAdminRequired * * @param int $id * @@ -197,6 +198,7 @@ public function show(int $id): JSONResponse { * @throws ServiceException */ #[TrapError] + #[NoAdminRequired] public function getBody(int $id): JSONResponse { try { $message = $this->mailManager->getMessage($this->currentUserId, $id); @@ -256,15 +258,14 @@ public function getBody(int $id): JSONResponse { } /** - * @NoAdminRequired * * @param int $id * * @return JSONResponse - * * @throws ClientException */ #[TrapError] + #[NoAdminRequired] public function getItineraries(int $id): JSONResponse { try { $message = $this->mailManager->getMessage($this->currentUserId, $id); @@ -280,10 +281,10 @@ public function getItineraries(int $id): JSONResponse { } /** - * @NoAdminRequired * @param int $id * @return JSONResponse */ + #[NoAdminRequired] public function getDkim(int $id): JSONResponse { try { $message = $this->mailManager->getMessage($this->currentUserId, $id); @@ -315,15 +316,14 @@ private function isSenderTrusted(Message $message): bool { } /** - * @NoAdminRequired - * @NoCSRFRequired * * @param int $id - * * @return JSONResponse * @throws ClientException */ #[TrapError] + #[NoAdminRequired] + #[NoCSRFRequired] public function getThread(int $id): JSONResponse { try { $message = $this->mailManager->getMessage($this->currentUserId, $id); @@ -341,7 +341,6 @@ public function getThread(int $id): JSONResponse { } /** - * @NoAdminRequired * * @param int $id * @param int $destFolderId @@ -352,6 +351,7 @@ public function getThread(int $id): JSONResponse { * @throws ServiceException */ #[TrapError] + #[NoAdminRequired] public function move(int $id, int $destFolderId): JSONResponse { try { $message = $this->mailManager->getMessage($this->currentUserId, $id); @@ -374,7 +374,6 @@ public function move(int $id, int $destFolderId): JSONResponse { } /** - * @NoAdminRequired * * @param int $id * @param int $unixTimestamp @@ -385,6 +384,7 @@ public function move(int $id, int $destFolderId): JSONResponse { * @throws ServiceException */ #[TrapError] + #[NoAdminRequired] public function snooze(int $id, int $unixTimestamp, int $destMailboxId): JSONResponse { try { $message = $this->mailManager->getMessage($this->currentUserId, $id); @@ -402,7 +402,6 @@ public function snooze(int $id, int $unixTimestamp, int $destMailboxId): JSONRes } /** - * @NoAdminRequired * * @param int $id * @@ -411,6 +410,7 @@ public function snooze(int $id, int $unixTimestamp, int $destMailboxId): JSONRes * @throws ServiceException */ #[TrapError] + #[NoAdminRequired] public function unSnooze(int $id): JSONResponse { try { $message = $this->mailManager->getMessage($this->currentUserId, $id); @@ -424,7 +424,6 @@ public function unSnooze(int $id): JSONResponse { } /** - * @NoAdminRequired * * @param int $id * @@ -434,6 +433,7 @@ public function unSnooze(int $id): JSONResponse { * @throws ServiceException */ #[TrapError] + #[NoAdminRequired] public function mdn(int $id): JSONResponse { try { $message = $this->mailManager->getMessage($this->currentUserId, $id); @@ -459,12 +459,12 @@ public function mdn(int $id): JSONResponse { } /** - * @NoAdminRequired - * @NoCSRFRequired * * @throws ServiceException */ #[TrapError] + #[NoAdminRequired] + #[NoCSRFRequired] public function getSource(int $id): JSONResponse { try { $message = $this->mailManager->getMessage($this->currentUserId, $id); @@ -497,8 +497,6 @@ public function getSource(int $id): JSONResponse { /** * Export a whole message as an .eml file. * - * @NoAdminRequired - * @NoCSRFRequired * * @param int $id * @return Response @@ -506,6 +504,8 @@ public function getSource(int $id): JSONResponse { * @throws ServiceException */ #[TrapError] + #[NoAdminRequired] + #[NoCSRFRequired] public function export(int $id): Response { try { $message = $this->mailManager->getMessage($this->currentUserId, $id); @@ -535,8 +535,6 @@ public function export(int $id): Response { } /** - * @NoAdminRequired - * @NoCSRFRequired * * @param int $id * @param bool $plain do not inject scripts if true (default=false) @@ -546,6 +544,8 @@ public function export(int $id): Response { * @throws ClientException */ #[TrapError] + #[NoAdminRequired] + #[NoCSRFRequired] public function getHtmlBody(int $id, bool $plain = false): Response { try { try { @@ -610,8 +610,6 @@ public function getHtmlBody(int $id, bool $plain = false): Response { } /** - * @NoAdminRequired - * @NoCSRFRequired * * @param int $id * @param string $attachmentId @@ -621,6 +619,8 @@ public function getHtmlBody(int $id, bool $plain = false): Response { * @throws ClientException */ #[TrapError] + #[NoAdminRequired] + #[NoCSRFRequired] public function downloadAttachment(int $id, string $attachmentId): Response { try { @@ -656,8 +656,6 @@ public function downloadAttachment(int $id, } /** - * @NoAdminRequired - * @NoCSRFRequired * * @param int $id the message id * @@ -668,6 +666,8 @@ public function downloadAttachment(int $id, * @throws DoesNotExistException */ #[TrapError] + #[NoAdminRequired] + #[NoCSRFRequired] public function downloadAttachments(int $id): Response { try { $message = $this->mailManager->getMessage($this->currentUserId, $id); @@ -692,7 +692,6 @@ public function downloadAttachments(int $id): Response { } /** - * @NoAdminRequired * * @param int $id * @param string $attachmentId @@ -706,6 +705,7 @@ public function downloadAttachments(int $id): Response { * @throws LockedException */ #[TrapError] + #[NoAdminRequired] public function saveAttachment(int $id, string $attachmentId, string $targetPath) { @@ -755,7 +755,6 @@ public function saveAttachment(int $id, } /** - * @NoAdminRequired * * @param int $id * @param array $flags @@ -766,6 +765,7 @@ public function saveAttachment(int $id, * @throws ServiceException */ #[TrapError] + #[NoAdminRequired] public function setFlags(int $id, array $flags): JSONResponse { try { $message = $this->mailManager->getMessage($this->currentUserId, $id); @@ -783,7 +783,6 @@ public function setFlags(int $id, array $flags): JSONResponse { } /** - * @NoAdminRequired * * @param int $id * @param string $imapLabel @@ -794,6 +793,7 @@ public function setFlags(int $id, array $flags): JSONResponse { * @throws ServiceException */ #[TrapError] + #[NoAdminRequired] public function setTag(int $id, string $imapLabel): JSONResponse { try { $message = $this->mailManager->getMessage($this->currentUserId, $id); @@ -814,7 +814,6 @@ public function setTag(int $id, string $imapLabel): JSONResponse { } /** - * @NoAdminRequired * * @param int $id * @param string $imapLabel @@ -825,6 +824,7 @@ public function setTag(int $id, string $imapLabel): JSONResponse { * @throws ServiceException */ #[TrapError] + #[NoAdminRequired] public function removeTag(int $id, string $imapLabel): JSONResponse { try { $message = $this->mailManager->getMessage($this->currentUserId, $id); @@ -845,7 +845,6 @@ public function removeTag(int $id, string $imapLabel): JSONResponse { } /** - * @NoAdminRequired * * @param int $id * @@ -853,6 +852,7 @@ public function removeTag(int $id, string $imapLabel): JSONResponse { * @throws ServiceException */ #[TrapError] + #[NoAdminRequired] public function destroy(int $id): JSONResponse { try { $message = $this->mailManager->getMessage($this->currentUserId, $id); @@ -873,13 +873,12 @@ public function destroy(int $id): JSONResponse { } /** - * @NoAdminRequired * * @param int $messageId - * * @return JSONResponse */ #[TrapError] + #[NoAdminRequired] public function smartReply(int $messageId):JSONResponse { try { $message = $this->mailManager->getMessage($this->currentUserId, $messageId); diff --git a/lib/Controller/MicrosoftIntegrationController.php b/lib/Controller/MicrosoftIntegrationController.php index c62bfaf7df..803b055e89 100644 --- a/lib/Controller/MicrosoftIntegrationController.php +++ b/lib/Controller/MicrosoftIntegrationController.php @@ -16,6 +16,8 @@ use OCA\Mail\Service\AccountService; use OCP\AppFramework\Controller; use OCP\AppFramework\Http; +use OCP\AppFramework\Http\Attribute\NoAdminRequired; +use OCP\AppFramework\Http\Attribute\NoCSRFRequired; use OCP\AppFramework\Http\Attribute\OpenAPI; use OCP\AppFramework\Http\Response; use OCP\AppFramework\Http\StandaloneTemplateResponse; @@ -80,11 +82,11 @@ public function unlink(): JsonResponse { * @param string|null $session_state * @param string|null $error * - * @NoAdminRequired - * @NoCSRFRequired * * @return Response */ + #[NoAdminRequired] + #[NoCSRFRequired] public function oauthRedirect(?string $code, ?string $state, ?string $session_state, ?string $error): Response { if ($this->userId === null) { // TODO: redirect to main nextcloud page diff --git a/lib/Controller/OutOfOfficeController.php b/lib/Controller/OutOfOfficeController.php index 72e54642b2..ab3b8a00bf 100644 --- a/lib/Controller/OutOfOfficeController.php +++ b/lib/Controller/OutOfOfficeController.php @@ -19,6 +19,8 @@ use OCA\Mail\Service\OutOfOfficeService; use OCP\AppFramework\Controller; use OCP\AppFramework\Http; +use OCP\AppFramework\Http\Attribute\NoAdminRequired; +use OCP\AppFramework\Http\Attribute\NoCSRFRequired; use OCP\AppFramework\Http\Attribute\OpenAPI; use OCP\IRequest; use OCP\IUserSession; @@ -37,11 +39,9 @@ public function __construct( parent::__construct(Application::APP_ID, $request); } - /** - * @NoAdminRequired - * @NoCSRFRequired - */ #[TrapError] + #[NoAdminRequired] + #[NoCSRFRequired] public function getState(int $accountId): JsonResponse { $user = $this->userSession->getUser(); if ($user === null) { @@ -57,10 +57,8 @@ public function getState(int $accountId): JsonResponse { return JsonResponse::success($state); } - /** - * @NoAdminRequired - */ #[TrapError] + #[NoAdminRequired] public function followSystem(int $accountId) { if (!$this->container->has(IAvailabilityCoordinator::class)) { return JsonResponse::fail([], Http::STATUS_NOT_IMPLEMENTED); @@ -86,10 +84,8 @@ public function followSystem(int $accountId) { return JsonResponse::success($state); } - /** - * @NoAdminRequired - */ #[TrapError] + #[NoAdminRequired] public function update( int $accountId, bool $enabled, diff --git a/lib/Controller/OutboxController.php b/lib/Controller/OutboxController.php index e12ee31eaf..af9a90b917 100644 --- a/lib/Controller/OutboxController.php +++ b/lib/Controller/OutboxController.php @@ -20,6 +20,7 @@ use OCP\AppFramework\Controller; use OCP\AppFramework\Db\DoesNotExistException; use OCP\AppFramework\Http; +use OCP\AppFramework\Http\Attribute\NoAdminRequired; use OCP\AppFramework\Http\Attribute\OpenAPI; use OCP\IRequest; @@ -44,29 +45,27 @@ public function __construct(string $appName, } /** - * @NoAdminRequired - * * @return JsonResponse */ #[TrapError] + #[NoAdminRequired] public function index(): JsonResponse { return JsonResponse::success(['messages' => $this->service->getMessages($this->userId)]); } /** - * @NoAdminRequired * * @param int $id * @return JsonResponse */ #[TrapError] + #[NoAdminRequired] public function show(int $id): JsonResponse { $message = $this->service->getMessage($id, $this->userId); return JsonResponse::success($message); } /** - * @NoAdminRequired * * @param int $accountId * @param string $subject @@ -87,6 +86,7 @@ public function show(int $id): JsonResponse { * @throws ClientException */ #[TrapError] + #[NoAdminRequired] public function create( int $accountId, string $subject, @@ -137,11 +137,10 @@ public function create( } /** - * @NoAdminRequired - * * @return JsonResponse */ #[TrapError] + #[NoAdminRequired] public function createFromDraft(DraftsService $draftsService, int $id, ?int $sendAt = null): JsonResponse { $draftMessage = $draftsService->getMessage($id, $this->userId); // Locate the account to check authorization @@ -156,7 +155,6 @@ public function createFromDraft(DraftsService $draftsService, int $id, ?int $sen } /** - * @NoAdminRequired * * @param int $id * @param int $accountId @@ -175,6 +173,7 @@ public function createFromDraft(DraftsService $draftsService, int $id, ?int $sen * @return JsonResponse */ #[TrapError] + #[NoAdminRequired] public function update( int $id, int $accountId, @@ -224,12 +223,12 @@ public function update( } /** - * @NoAdminRequired * * @param int $id * @return JsonResponse */ #[TrapError] + #[NoAdminRequired] public function send(int $id): JsonResponse { $message = $this->service->getMessage($id, $this->userId); $account = $this->accountService->find($this->userId, $message->getAccountId()); @@ -245,12 +244,12 @@ public function send(int $id): JsonResponse { } /** - * @NoAdminRequired * * @param int $id * @return JsonResponse */ #[TrapError] + #[NoAdminRequired] public function destroy(int $id): JsonResponse { $message = $this->service->getMessage($id, $this->userId); $this->service->deleteMessage($this->userId, $message); diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php index 2dd0e1dd34..405cff2583 100644 --- a/lib/Controller/PageController.php +++ b/lib/Controller/PageController.php @@ -24,6 +24,8 @@ use OCA\Mail\Service\SmimeService; use OCA\Viewer\Event\LoadViewer; use OCP\AppFramework\Controller; +use OCP\AppFramework\Http\Attribute\NoAdminRequired; +use OCP\AppFramework\Http\Attribute\NoCSRFRequired; use OCP\AppFramework\Http\Attribute\OpenAPI; use OCP\AppFramework\Http\ContentSecurityPolicy; use OCP\AppFramework\Http\RedirectResponse; @@ -126,11 +128,11 @@ public function __construct(string $appName, } /** - * @NoAdminRequired - * @NoCSRFRequired * * @return TemplateResponse renders the index page */ + #[NoAdminRequired] + #[NoCSRFRequired] public function index(): TemplateResponse { if (class_exists(LoadViewer::class)) { $this->dispatcher->dispatchTyped(new LoadViewer()); @@ -322,93 +324,93 @@ function (SmimeCertificate $certificate) { } /** - * @NoAdminRequired - * @NoCSRFRequired * * @return TemplateResponse */ + #[NoAdminRequired] + #[NoCSRFRequired] public function setup(): TemplateResponse { return $this->index(); } /** - * @NoAdminRequired - * @NoCSRFRequired * * @return TemplateResponse */ + #[NoAdminRequired] + #[NoCSRFRequired] public function mailbox(int $id): TemplateResponse { return $this->index(); } /** - * @NoAdminRequired - * @NoCSRFRequired * * @return TemplateResponse */ + #[NoAdminRequired] + #[NoCSRFRequired] public function thread(int $mailboxId, int $id): TemplateResponse { return $this->index(); } /** - * @NoAdminRequired - * @NoCSRFRequired * * @return TemplateResponse */ + #[NoAdminRequired] + #[NoCSRFRequired] public function filteredThread(string $filter, int $mailboxId, int $id): TemplateResponse { return $this->index(); } /** - * @NoAdminRequired - * @NoCSRFRequired * * @return TemplateResponse */ + #[NoAdminRequired] + #[NoCSRFRequired] public function outbox(): TemplateResponse { return $this->index(); } /** - * @NoAdminRequired - * @NoCSRFRequired * * @return TemplateResponse */ + #[NoAdminRequired] + #[NoCSRFRequired] public function outboxMessage(int $messageId): TemplateResponse { return $this->index(); } /** - * @NoAdminRequired - * @NoCSRFRequired * * @return TemplateResponse */ + #[NoAdminRequired] + #[NoCSRFRequired] public function draft(int $mailboxId, int $draftId): TemplateResponse { return $this->index(); } /** - * @NoAdminRequired - * @NoCSRFRequired * * @return TemplateResponse */ + #[NoAdminRequired] + #[NoCSRFRequired] public function filteredDraft(string $filter, int $mailboxId, int $draftId): TemplateResponse { return $this->index(); } /** - * @NoAdminRequired - * @NoCSRFRequired * * @param string $uri * * @return RedirectResponse */ + #[NoAdminRequired] + #[NoCSRFRequired] public function compose(string $uri): RedirectResponse { $parts = parse_url($uri); $params = ['to' => $parts['path']]; @@ -429,11 +431,11 @@ static function (&$value, $key) { return new RedirectResponse($baseUrl . $name); } /** - * @NoAdminRequired - * @NoCSRFRequired * * @return TemplateResponse */ + #[NoAdminRequired] + #[NoCSRFRequired] public function mailto(): TemplateResponse { return $this->index(); } diff --git a/lib/Controller/PreferencesController.php b/lib/Controller/PreferencesController.php index e6ef3bd6d9..66cd3dd078 100644 --- a/lib/Controller/PreferencesController.php +++ b/lib/Controller/PreferencesController.php @@ -13,6 +13,7 @@ use OCA\Mail\Exception\ClientException; use OCA\Mail\Http\TrapError; use OCP\AppFramework\Controller; +use OCP\AppFramework\Http\Attribute\NoAdminRequired; use OCP\AppFramework\Http\Attribute\OpenAPI; use OCP\AppFramework\Http\JSONResponse; use OCP\IRequest; @@ -35,12 +36,12 @@ public function __construct(IRequest $request, IUserPreferences $userPreference, } /** - * @NoAdminRequired * * @param string $id * @return JSONResponse */ #[TrapError] + #[NoAdminRequired] public function show(string $id): JSONResponse { return new JSONResponse([ 'value' => $this->userPreference->getPreference($this->userId, $id) @@ -48,7 +49,6 @@ public function show(string $id): JSONResponse { } /** - * @NoAdminRequired * * @param string $key * @param string $value @@ -56,6 +56,7 @@ public function show(string $id): JSONResponse { * @throws ClientException */ #[TrapError] + #[NoAdminRequired] public function update($key, $value): JSONResponse { if (is_null($key) || is_null($value)) { throw new ClientException('key or value missing'); diff --git a/lib/Controller/ProxyController.php b/lib/Controller/ProxyController.php index 481c88c13f..397c250e15 100644 --- a/lib/Controller/ProxyController.php +++ b/lib/Controller/ProxyController.php @@ -13,6 +13,8 @@ use Exception; use OCA\Mail\Http\ProxyDownloadResponse; use OCP\AppFramework\Controller; +use OCP\AppFramework\Http\Attribute\NoAdminRequired; +use OCP\AppFramework\Http\Attribute\NoCSRFRequired; use OCP\AppFramework\Http\Attribute\OpenAPI; use OCP\AppFramework\Http\Attribute\UserRateLimit; use OCP\AppFramework\Http\TemplateResponse; @@ -46,14 +48,13 @@ public function __construct(string $appName, } /** - * @NoAdminRequired - * @NoCSRFRequired * * @param string $src - * * @throws \Exception If the URL is not valid. * @return TemplateResponse */ + #[NoAdminRequired] + #[NoCSRFRequired] public function redirect(string $src): TemplateResponse { $authorizedRedirect = false; @@ -78,8 +79,6 @@ public function redirect(string $src): TemplateResponse { } /** - * @NoAdminRequired - * @NoCSRFRequired * @UserRateThrottle(limit=50, period=60) * * @param string $src @@ -91,6 +90,8 @@ public function redirect(string $src): TemplateResponse { * @return ProxyDownloadResponse */ #[UserRateLimit(limit: 50, period: 60)] + #[NoAdminRequired] + #[NoCSRFRequired] public function proxy(string $src): ProxyDownloadResponse { // close the session to allow parallel downloads $this->session->close(); diff --git a/lib/Controller/SieveController.php b/lib/Controller/SieveController.php index 6d4ebdae06..b25eccfbf2 100644 --- a/lib/Controller/SieveController.php +++ b/lib/Controller/SieveController.php @@ -21,6 +21,7 @@ use OCP\AppFramework\Controller; use OCP\AppFramework\Db\DoesNotExistException; use OCP\AppFramework\Http; +use OCP\AppFramework\Http\Attribute\NoAdminRequired; use OCP\AppFramework\Http\Attribute\OpenAPI; use OCP\AppFramework\Http\JSONResponse; use OCP\IRequest; @@ -56,7 +57,6 @@ public function __construct(IRequest $request, } /** - * @NoAdminRequired * * @param int $id account id * @@ -67,6 +67,7 @@ public function __construct(IRequest $request, * @throws ManagesieveException */ #[TrapError] + #[NoAdminRequired] public function getActiveScript(int $id): JSONResponse { $activeScript = $this->sieveService->getActiveScript($this->currentUserId, $id); return new JSONResponse([ @@ -76,7 +77,6 @@ public function getActiveScript(int $id): JSONResponse { } /** - * @NoAdminRequired * * @param int $id account id * @param string $script @@ -87,6 +87,7 @@ public function getActiveScript(int $id): JSONResponse { * @throws CouldNotConnectException */ #[TrapError] + #[NoAdminRequired] public function updateActiveScript(int $id, string $script): JSONResponse { try { $this->sieveService->updateActiveScript($this->currentUserId, $id, $script); @@ -99,7 +100,6 @@ public function updateActiveScript(int $id, string $script): JSONResponse { } /** - * @NoAdminRequired * * @param int $id account id * @param bool $sieveEnabled @@ -115,6 +115,7 @@ public function updateActiveScript(int $id, string $script): JSONResponse { * @throws DoesNotExistException */ #[TrapError] + #[NoAdminRequired] public function updateAccount(int $id, bool $sieveEnabled, string $sieveHost, diff --git a/lib/Controller/SmimeCertificatesController.php b/lib/Controller/SmimeCertificatesController.php index 5114159364..b220e25a98 100644 --- a/lib/Controller/SmimeCertificatesController.php +++ b/lib/Controller/SmimeCertificatesController.php @@ -19,6 +19,7 @@ use OCP\AppFramework\Controller; use OCP\AppFramework\Db\DoesNotExistException; use OCP\AppFramework\Http; +use OCP\AppFramework\Http\Attribute\NoAdminRequired; use OCP\AppFramework\Http\Attribute\OpenAPI; use OCP\IRequest; @@ -37,12 +38,12 @@ public function __construct(string $appName, } /** - * @NoAdminRequired * * @throws ServiceException * @throws SmimeCertificateParserException */ #[TrapError] + #[NoAdminRequired] public function index(): JsonResponse { $certificates = $this->certificateService->findAllCertificates($this->userId); $certificates = array_map(function (SmimeCertificate $certificate) { @@ -52,21 +53,19 @@ public function index(): JsonResponse { } /** - * @NoAdminRequired * * @param int $id * @return JsonResponse - * * @throws DoesNotExistException */ #[TrapError] + #[NoAdminRequired] public function destroy(int $id): JsonResponse { $this->certificateService->deleteCertificate($id, $this->userId); return JsonResponse::success(); } /** - * @NoAdminRequired * * @return JsonResponse * @@ -74,6 +73,7 @@ public function destroy(int $id): JsonResponse { * @throws SmimeCertificateParserException */ #[TrapError] + #[NoAdminRequired] public function create(): JsonResponse { // TODO: What about PKCS12 certificates? // They need to be decrypted by the client because they are protected by a password. diff --git a/lib/Controller/TagsController.php b/lib/Controller/TagsController.php index c63cb4b235..3d130cce7b 100644 --- a/lib/Controller/TagsController.php +++ b/lib/Controller/TagsController.php @@ -17,6 +17,7 @@ use OCP\AppFramework\Controller; use OCP\AppFramework\Db\DoesNotExistException; use OCP\AppFramework\Http; +use OCP\AppFramework\Http\Attribute\NoAdminRequired; use OCP\AppFramework\Http\Attribute\OpenAPI; use OCP\AppFramework\Http\JSONResponse; use OCP\IRequest; @@ -41,7 +42,6 @@ public function __construct(IRequest $request, } /** - * @NoAdminRequired * * @param string $displayName * @param string $color @@ -50,6 +50,7 @@ public function __construct(IRequest $request, * @throws ClientException */ #[TrapError] + #[NoAdminRequired] public function create(string $displayName, string $color): JSONResponse { $this->validateDisplayName($displayName); $this->validateColor($color); @@ -59,7 +60,6 @@ public function create(string $displayName, string $color): JSONResponse { } /** - * @NoAdminRequired * * @param int $id * @param string $displayName @@ -69,6 +69,7 @@ public function create(string $displayName, string $color): JSONResponse { * @throws ClientException */ #[TrapError] + #[NoAdminRequired] public function update(int $id, string $displayName, string $color): JSONResponse { $this->validateDisplayName($displayName); $this->validateColor($color); @@ -77,11 +78,10 @@ public function update(int $id, string $displayName, string $color): JSONRespons return new JSONResponse($tag); } /** - * @NoAdminRequired - * * @throws ClientException */ #[TrapError] + #[NoAdminRequired] public function delete(int $id, int $accountId): JSONResponse { try { $accounts = $this->accountService->findByUserId($this->currentUserId); diff --git a/lib/Controller/ThreadController.php b/lib/Controller/ThreadController.php index 9265a5f62f..0bfc9d70b3 100755 --- a/lib/Controller/ThreadController.php +++ b/lib/Controller/ThreadController.php @@ -19,6 +19,7 @@ use OCP\AppFramework\Controller; use OCP\AppFramework\Db\DoesNotExistException; use OCP\AppFramework\Http; +use OCP\AppFramework\Http\Attribute\NoAdminRequired; use OCP\AppFramework\Http\Attribute\OpenAPI; use OCP\AppFramework\Http\JSONResponse; use OCP\IRequest; @@ -52,7 +53,6 @@ public function __construct(string $appName, } /** - * @NoAdminRequired * * @param int $id * @param int $destMailboxId @@ -62,6 +62,7 @@ public function __construct(string $appName, * @throws ServiceException */ #[TrapError] + #[NoAdminRequired] public function move(int $id, int $destMailboxId): JSONResponse { try { $message = $this->mailManager->getMessage($this->currentUserId, $id); @@ -85,7 +86,6 @@ public function move(int $id, int $destMailboxId): JSONResponse { } /** - * @NoAdminRequired * * @param int $id * @param int $unixTimestamp @@ -96,6 +96,7 @@ public function move(int $id, int $destMailboxId): JSONResponse { * @throws ServiceException */ #[TrapError] + #[NoAdminRequired] public function snooze(int $id, int $unixTimestamp, int $destMailboxId): JSONResponse { try { $selectedMessage = $this->mailManager->getMessage($this->currentUserId, $id); @@ -113,7 +114,6 @@ public function snooze(int $id, int $unixTimestamp, int $destMailboxId): JSONRes } /** - * @NoAdminRequired * * @param int $id * @@ -122,6 +122,7 @@ public function snooze(int $id, int $unixTimestamp, int $destMailboxId): JSONRes * @throws ServiceException */ #[TrapError] + #[NoAdminRequired] public function unSnooze(int $id): JSONResponse { try { $selectedMessage = $this->mailManager->getMessage($this->currentUserId, $id); @@ -135,12 +136,11 @@ public function unSnooze(int $id): JSONResponse { } /** - * @NoAdminRequired * * @param int $id - * * @return JSONResponse */ + #[NoAdminRequired] public function summarize(int $id): JSONResponse { try { $message = $this->mailManager->getMessage($this->currentUserId, $id); @@ -170,9 +170,7 @@ public function summarize(int $id): JSONResponse { return new JSONResponse(['data' => $summary]); } - /** - * @NoAdminRequired - */ + #[NoAdminRequired] public function generateEventData(int $id): JSONResponse { try { $message = $this->mailManager->getMessage($this->currentUserId, $id); @@ -196,7 +194,6 @@ public function generateEventData(int $id): JSONResponse { } /** - * @NoAdminRequired * * @param int $id * @@ -205,6 +202,7 @@ public function generateEventData(int $id): JSONResponse { * @throws ServiceException */ #[TrapError] + #[NoAdminRequired] public function delete(int $id): JSONResponse { try { $message = $this->mailManager->getMessage($this->currentUserId, $id); diff --git a/lib/Controller/TrustedSendersController.php b/lib/Controller/TrustedSendersController.php index 187d3e2410..ad2e156707 100644 --- a/lib/Controller/TrustedSendersController.php +++ b/lib/Controller/TrustedSendersController.php @@ -15,6 +15,7 @@ use OCA\Mail\Http\TrapError; use OCP\AppFramework\Controller; use OCP\AppFramework\Http; +use OCP\AppFramework\Http\Attribute\NoAdminRequired; use OCP\AppFramework\Http\Attribute\OpenAPI; use OCP\IRequest; @@ -33,13 +34,13 @@ public function __construct(IRequest $request, } /** - * @NoAdminRequired * * @param string $email * @param string $type * @return JsonResponse */ #[TrapError] + #[NoAdminRequired] public function setTrusted(string $email, string $type): JsonResponse { $this->trustedSenderService->trust( $this->uid, @@ -51,13 +52,13 @@ public function setTrusted(string $email, string $type): JsonResponse { } /** - * @NoAdminRequired * * @param string $email * @param string $type * @return JsonResponse */ #[TrapError] + #[NoAdminRequired] public function removeTrust(string $email, string $type): JsonResponse { $this->trustedSenderService->trust( $this->uid, @@ -69,11 +70,10 @@ public function removeTrust(string $email, string $type): JsonResponse { return JsonResponse::success(null); } /** - * @NoAdminRequired - * * @return JsonResponse */ #[TrapError] + #[NoAdminRequired] public function list(): JsonResponse { $list = $this->trustedSenderService->getTrusted( $this->uid diff --git a/rector.php b/rector.php index af32da3e0f..54e726b017 100644 --- a/rector.php +++ b/rector.php @@ -28,4 +28,6 @@ ->withSets([ \ChristophWurst\Nextcloud\Rector\Set\NextcloudSets::NEXTCLOUD_ALL, \ChristophWurst\Nextcloud\Rector\Set\NextcloudSets::NEXTCLOUD_25, + \ChristophWurst\Nextcloud\Rector\Set\NextcloudSets::NEXTCLOUD_26, + \ChristophWurst\Nextcloud\Rector\Set\NextcloudSets::NEXTCLOUD_27, ]); diff --git a/vendor-bin/rector/composer.json b/vendor-bin/rector/composer.json index aef382c009..0e9a06d3c4 100644 --- a/vendor-bin/rector/composer.json +++ b/vendor-bin/rector/composer.json @@ -3,7 +3,7 @@ "sort-packages": true }, "require-dev": { - "christophwurst/nextcloud-rector": "^0.1.2", + "christophwurst/nextcloud-rector": "^0.2.1", "rector/rector": "^1.2.4" } } diff --git a/vendor-bin/rector/composer.lock b/vendor-bin/rector/composer.lock index aaf55d5f07..1ac8bfda0a 100644 --- a/vendor-bin/rector/composer.lock +++ b/vendor-bin/rector/composer.lock @@ -4,21 +4,21 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "38703a9b83f7e93c63b6f814e2d0b25b", + "content-hash": "fff61abda66546bf8944236a00e50516", "packages": [], "packages-dev": [ { "name": "christophwurst/nextcloud-rector", - "version": "v0.1.2", + "version": "v0.2.1", "source": { "type": "git", "url": "https://github.com/ChristophWurst/nextcloud-rector.git", - "reference": "f98c2d8bd13654a6c27ea0d9788949e90912f800" + "reference": "9bd7c3d199000bf0fc9bbc2012bcbaa4d64cd974" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ChristophWurst/nextcloud-rector/zipball/f98c2d8bd13654a6c27ea0d9788949e90912f800", - "reference": "f98c2d8bd13654a6c27ea0d9788949e90912f800", + "url": "https://api.github.com/repos/ChristophWurst/nextcloud-rector/zipball/9bd7c3d199000bf0fc9bbc2012bcbaa4d64cd974", + "reference": "9bd7c3d199000bf0fc9bbc2012bcbaa4d64cd974", "shasum": "" }, "require": { @@ -65,9 +65,9 @@ ], "support": { "issues": "https://github.com/ChristophWurst/nextcloud-rector/issues", - "source": "https://github.com/ChristophWurst/nextcloud-rector/tree/v0.1.2" + "source": "https://github.com/ChristophWurst/nextcloud-rector/tree/v0.2.1" }, - "time": "2024-09-11T06:54:05+00:00" + "time": "2024-09-11T08:09:51+00:00" }, { "name": "phpstan/phpstan", From 85de57aad5b4792783b99d1ac6fea7d6aa381111 Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Wed, 18 Sep 2024 15:31:05 +0200 Subject: [PATCH 3/4] fixup! refactor: Use Nextcloud sets for rector Signed-off-by: Christoph Wurst --- rector.php | 8 ++++---- vendor-bin/rector/composer.json | 2 +- vendor-bin/rector/composer.lock | 22 +++++++++++----------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/rector.php b/rector.php index 54e726b017..31cb8eaaa2 100644 --- a/rector.php +++ b/rector.php @@ -26,8 +26,8 @@ __DIR__ . '/../../lib/composer/autoload.php', ]) ->withSets([ - \ChristophWurst\Nextcloud\Rector\Set\NextcloudSets::NEXTCLOUD_ALL, - \ChristophWurst\Nextcloud\Rector\Set\NextcloudSets::NEXTCLOUD_25, - \ChristophWurst\Nextcloud\Rector\Set\NextcloudSets::NEXTCLOUD_26, - \ChristophWurst\Nextcloud\Rector\Set\NextcloudSets::NEXTCLOUD_27, + \Nextcloud\Rector\Set\NextcloudSets::NEXTCLOUD_ALL, + \Nextcloud\Rector\Set\NextcloudSets::NEXTCLOUD_25, + \Nextcloud\Rector\Set\NextcloudSets::NEXTCLOUD_26, + \Nextcloud\Rector\Set\NextcloudSets::NEXTCLOUD_27, ]); diff --git a/vendor-bin/rector/composer.json b/vendor-bin/rector/composer.json index 0e9a06d3c4..c655364897 100644 --- a/vendor-bin/rector/composer.json +++ b/vendor-bin/rector/composer.json @@ -3,7 +3,7 @@ "sort-packages": true }, "require-dev": { - "christophwurst/nextcloud-rector": "^0.2.1", + "nextcloud/rector": "^0.1.0", "rector/rector": "^1.2.4" } } diff --git a/vendor-bin/rector/composer.lock b/vendor-bin/rector/composer.lock index 1ac8bfda0a..9a5a2dab64 100644 --- a/vendor-bin/rector/composer.lock +++ b/vendor-bin/rector/composer.lock @@ -4,21 +4,21 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "fff61abda66546bf8944236a00e50516", + "content-hash": "3d9c3c657ac50411a783ebafed936e26", "packages": [], "packages-dev": [ { - "name": "christophwurst/nextcloud-rector", - "version": "v0.2.1", + "name": "nextcloud/rector", + "version": "v0.1.0", "source": { "type": "git", - "url": "https://github.com/ChristophWurst/nextcloud-rector.git", - "reference": "9bd7c3d199000bf0fc9bbc2012bcbaa4d64cd974" + "url": "https://github.com/nextcloud-libraries/rector.git", + "reference": "f88640d66dd18c900a9c08da4c6001a82abc972b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ChristophWurst/nextcloud-rector/zipball/9bd7c3d199000bf0fc9bbc2012bcbaa4d64cd974", - "reference": "9bd7c3d199000bf0fc9bbc2012bcbaa4d64cd974", + "url": "https://api.github.com/repos/nextcloud-libraries/rector/zipball/f88640d66dd18c900a9c08da4c6001a82abc972b", + "reference": "f88640d66dd18c900a9c08da4c6001a82abc972b", "shasum": "" }, "require": { @@ -44,7 +44,7 @@ }, "autoload": { "psr-4": { - "ChristophWurst\\Nextcloud\\Rector\\": "src/" + "Nextcloud\\Rector\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -64,10 +64,10 @@ "refactoring" ], "support": { - "issues": "https://github.com/ChristophWurst/nextcloud-rector/issues", - "source": "https://github.com/ChristophWurst/nextcloud-rector/tree/v0.2.1" + "issues": "https://github.com/nextcloud-libraries/rector/issues", + "source": "https://github.com/nextcloud-libraries/rector/tree/v0.1.0" }, - "time": "2024-09-11T08:09:51+00:00" + "time": "2024-09-18T12:33:43+00:00" }, { "name": "phpstan/phpstan", From 294b89a19498184515c62f80f14d45cfe41d91a0 Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Wed, 18 Sep 2024 15:31:27 +0200 Subject: [PATCH 4/4] fixup! refactor: Use Nextcloud sets for rector Signed-off-by: Christoph Wurst --- lib/Controller/AccountsController.php | 2 +- lib/Controller/AliasesController.php | 2 +- lib/Controller/AvatarsController.php | 2 +- lib/Controller/DraftsController.php | 2 +- lib/Controller/GoogleIntegrationController.php | 2 +- lib/Controller/LocalAttachmentsController.php | 2 +- lib/Controller/MailboxesController.php | 2 +- lib/Controller/MessagesController.php | 2 +- lib/Controller/MicrosoftIntegrationController.php | 2 +- lib/Controller/OutboxController.php | 2 +- lib/Controller/PageController.php | 2 +- lib/Controller/PreferencesController.php | 2 +- lib/Controller/SieveController.php | 2 +- lib/Controller/TagsController.php | 2 +- lib/Controller/ThreadController.php | 2 +- lib/Controller/TrustedSendersController.php | 2 +- 16 files changed, 16 insertions(+), 16 deletions(-) diff --git a/lib/Controller/AccountsController.php b/lib/Controller/AccountsController.php index ff664d046f..81ab5c934a 100644 --- a/lib/Controller/AccountsController.php +++ b/lib/Controller/AccountsController.php @@ -55,7 +55,7 @@ class AccountsController extends Controller { public function __construct(string $appName, IRequest $request, AccountService $accountService, - $UserId, + $userId, LoggerInterface $logger, IL10N $l10n, AliasesService $aliasesService, diff --git a/lib/Controller/AliasesController.php b/lib/Controller/AliasesController.php index 3493d3f662..3172dc6c5e 100644 --- a/lib/Controller/AliasesController.php +++ b/lib/Controller/AliasesController.php @@ -28,7 +28,7 @@ class AliasesController extends Controller { public function __construct(string $appName, IRequest $request, AliasesService $aliasesService, - string $UserId) { + string $userId) { parent::__construct($appName, $request); $this->aliasService = $aliasesService; $this->currentUserId = $UserId; diff --git a/lib/Controller/AvatarsController.php b/lib/Controller/AvatarsController.php index b29c7d554f..9d82e23742 100644 --- a/lib/Controller/AvatarsController.php +++ b/lib/Controller/AvatarsController.php @@ -29,7 +29,7 @@ class AvatarsController extends Controller { public function __construct(string $appName, IRequest $request, IAvatarService $avatarService, - string $UserId) { + string $userId) { parent::__construct($appName, $request); $this->avatarService = $avatarService; diff --git a/lib/Controller/DraftsController.php b/lib/Controller/DraftsController.php index e484bcb445..773fdfe7bb 100644 --- a/lib/Controller/DraftsController.php +++ b/lib/Controller/DraftsController.php @@ -34,7 +34,7 @@ class DraftsController extends Controller { public function __construct(string $appName, - $UserId, + $userId, IRequest $request, DraftsService $service, AccountService $accountService, diff --git a/lib/Controller/GoogleIntegrationController.php b/lib/Controller/GoogleIntegrationController.php index b5aee976a2..ffb81b06d4 100644 --- a/lib/Controller/GoogleIntegrationController.php +++ b/lib/Controller/GoogleIntegrationController.php @@ -40,7 +40,7 @@ class GoogleIntegrationController extends Controller { public function __construct(IRequest $request, - ?string $UserId, + ?string $userId, GoogleIntegration $googleIntegration, AccountService $accountService, LoggerInterface $logger, diff --git a/lib/Controller/LocalAttachmentsController.php b/lib/Controller/LocalAttachmentsController.php index 73df3d9727..6753e98330 100644 --- a/lib/Controller/LocalAttachmentsController.php +++ b/lib/Controller/LocalAttachmentsController.php @@ -32,7 +32,7 @@ class LocalAttachmentsController extends Controller { * @param string $UserId */ public function __construct(string $appName, IRequest $request, - IAttachmentService $attachmentService, $UserId) { + IAttachmentService $attachmentService, $userId) { parent::__construct($appName, $request); $this->attachmentService = $attachmentService; $this->userId = $UserId; diff --git a/lib/Controller/MailboxesController.php b/lib/Controller/MailboxesController.php index 2fa36bc786..fdd622d09c 100644 --- a/lib/Controller/MailboxesController.php +++ b/lib/Controller/MailboxesController.php @@ -46,7 +46,7 @@ class MailboxesController extends Controller { public function __construct(string $appName, IRequest $request, AccountService $accountService, - ?string $UserId, + ?string $userId, IMailManager $mailManager, SyncService $syncService) { parent::__construct($appName, $request); diff --git a/lib/Controller/MessagesController.php b/lib/Controller/MessagesController.php index fbfd49529a..20deb896ae 100755 --- a/lib/Controller/MessagesController.php +++ b/lib/Controller/MessagesController.php @@ -82,7 +82,7 @@ public function __construct(string $appName, IMailManager $mailManager, IMailSearch $mailSearch, ItineraryService $itineraryService, - ?string $UserId, + ?string $userId, $userFolder, LoggerInterface $logger, IL10N $l10n, diff --git a/lib/Controller/MicrosoftIntegrationController.php b/lib/Controller/MicrosoftIntegrationController.php index 803b055e89..7ce3b322a9 100644 --- a/lib/Controller/MicrosoftIntegrationController.php +++ b/lib/Controller/MicrosoftIntegrationController.php @@ -33,7 +33,7 @@ class MicrosoftIntegrationController extends Controller { private LoggerInterface $logger; public function __construct(IRequest $request, - ?string $UserId, + ?string $userId, AccountService $accountService, MicrosoftIntegration $microsoftIntegration, LoggerInterface $logger) { diff --git a/lib/Controller/OutboxController.php b/lib/Controller/OutboxController.php index af9a90b917..d07e807db8 100644 --- a/lib/Controller/OutboxController.php +++ b/lib/Controller/OutboxController.php @@ -32,7 +32,7 @@ class OutboxController extends Controller { private SmimeService $smimeService; public function __construct(string $appName, - $UserId, + $userId, IRequest $request, OutboxService $service, AccountService $accountService, diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php index 405cff2583..8b47ae93fe 100644 --- a/lib/Controller/PageController.php +++ b/lib/Controller/PageController.php @@ -81,7 +81,7 @@ public function __construct(string $appName, IConfig $config, AccountService $accountService, AliasesService $aliasesService, - ?string $UserId, + ?string $userId, IUserSession $userSession, IUserPreferences $preferences, IMailManager $mailManager, diff --git a/lib/Controller/PreferencesController.php b/lib/Controller/PreferencesController.php index 66cd3dd078..9974f5ba64 100644 --- a/lib/Controller/PreferencesController.php +++ b/lib/Controller/PreferencesController.php @@ -28,7 +28,7 @@ class PreferencesController extends Controller { * @param IUserPreferences $userPreference * @param string $UserId */ - public function __construct(IRequest $request, IUserPreferences $userPreference, string $UserId) { + public function __construct(IRequest $request, IUserPreferences $userPreference, string $userId) { parent::__construct('mail', $request); $this->userPreference = $userPreference; diff --git a/lib/Controller/SieveController.php b/lib/Controller/SieveController.php index b25eccfbf2..95e1a2d76f 100644 --- a/lib/Controller/SieveController.php +++ b/lib/Controller/SieveController.php @@ -39,7 +39,7 @@ class SieveController extends Controller { private LoggerInterface $logger; public function __construct(IRequest $request, - string $UserId, + string $userId, MailAccountMapper $mailAccountMapper, SieveClientFactory $sieveClientFactory, ICrypto $crypto, diff --git a/lib/Controller/TagsController.php b/lib/Controller/TagsController.php index 3d130cce7b..05df96ae85 100644 --- a/lib/Controller/TagsController.php +++ b/lib/Controller/TagsController.php @@ -31,7 +31,7 @@ class TagsController extends Controller { public function __construct(IRequest $request, - string $UserId, + string $userId, IMailManager $mailManager, AccountService $accountService, ) { diff --git a/lib/Controller/ThreadController.php b/lib/Controller/ThreadController.php index 0bfc9d70b3..b8792e8f1a 100755 --- a/lib/Controller/ThreadController.php +++ b/lib/Controller/ThreadController.php @@ -37,7 +37,7 @@ class ThreadController extends Controller { public function __construct(string $appName, IRequest $request, - string $UserId, + string $userId, AccountService $accountService, IMailManager $mailManager, SnoozeService $snoozeService, diff --git a/lib/Controller/TrustedSendersController.php b/lib/Controller/TrustedSendersController.php index ad2e156707..51495ca5a4 100644 --- a/lib/Controller/TrustedSendersController.php +++ b/lib/Controller/TrustedSendersController.php @@ -25,7 +25,7 @@ class TrustedSendersController extends Controller { private ITrustedSenderService $trustedSenderService; public function __construct(IRequest $request, - ?string $UserId, + ?string $userId, ITrustedSenderService $trustedSenderService) { parent::__construct(Application::APP_ID, $request);