diff --git a/.ci/php-cs-fixer/composer.lock b/.ci/php-cs-fixer/composer.lock index 0cd828f5d4..d0534abbcf 100644 --- a/.ci/php-cs-fixer/composer.lock +++ b/.ci/php-cs-fixer/composer.lock @@ -226,16 +226,16 @@ }, { "name": "friendsofphp/php-cs-fixer", - "version": "v3.43.0", + "version": "v3.43.1", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", - "reference": "39b5632c39ca9deb4eb7e670ba96fcf5c3a72e3c" + "reference": "91c0b47216aa43b09656b4d99aa9dade2f3ad8fc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/39b5632c39ca9deb4eb7e670ba96fcf5c3a72e3c", - "reference": "39b5632c39ca9deb4eb7e670ba96fcf5c3a72e3c", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/91c0b47216aa43b09656b4d99aa9dade2f3ad8fc", + "reference": "91c0b47216aa43b09656b4d99aa9dade2f3ad8fc", "shasum": "" }, "require": { @@ -304,7 +304,7 @@ ], "support": { "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", - "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.43.0" + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.43.1" }, "funding": [ { @@ -312,7 +312,7 @@ "type": "github" } ], - "time": "2023-12-28T17:36:39+00:00" + "time": "2023-12-29T09:42:16+00:00" }, { "name": "psr/container", diff --git a/app/Api/V1/Controllers/Webhook/AttemptController.php b/app/Api/V1/Controllers/Webhook/AttemptController.php index 0bd2b291f2..abda6e93a3 100644 --- a/app/Api/V1/Controllers/Webhook/AttemptController.php +++ b/app/Api/V1/Controllers/Webhook/AttemptController.php @@ -71,6 +71,7 @@ class AttemptController extends Controller throw new FireflyException('200040: Webhook and webhook message are no match'); } if(false === config('firefly.allow_webhooks')) { + Log::channel('audit')->info(sprintf('User lists webhook attempts of webhook #%d and message #%d, but webhooks are DISABLED.', $webhook->id, $message->id)); throw new NotFoundHttpException('Webhooks are not enabled.'); } Log::channel('audit')->info(sprintf('User lists webhook attempts of webhook #%d and message #%d.', $webhook->id, $message->id)); @@ -113,6 +114,7 @@ class AttemptController extends Controller } if(false === config('firefly.allow_webhooks')) { + Log::channel('audit')->info(sprintf('User views single webhook attempt #%d of webhook #%d and message #%d, but webhooks are DISABLED', $attempt->id, $webhook->id, $message->id)); throw new NotFoundHttpException('Webhooks are not enabled.'); } diff --git a/app/Api/V1/Controllers/Webhook/DestroyController.php b/app/Api/V1/Controllers/Webhook/DestroyController.php index 0692db76fb..43f1fcd11c 100644 --- a/app/Api/V1/Controllers/Webhook/DestroyController.php +++ b/app/Api/V1/Controllers/Webhook/DestroyController.php @@ -63,6 +63,7 @@ class DestroyController extends Controller public function destroy(Webhook $webhook): JsonResponse { if(false === config('firefly.allow_webhooks')) { + Log::channel('audit')->info(sprintf('User tries to destroy webhook #%d. but webhooks are DISABLED.', $webhook->id)); throw new NotFoundHttpException('Webhooks are not enabled.'); } @@ -91,6 +92,7 @@ class DestroyController extends Controller } if (false === config('firefly.allow_webhooks')) { + Log::channel('audit')->info(sprintf('User tries to destroy webhook #%d, message #%d, attempt #%d, but webhooks are DISABLED.', $webhook->id, $message->id, $attempt->id)); throw new NotFoundHttpException('Webhooks are not enabled.'); } @@ -112,14 +114,15 @@ class DestroyController extends Controller */ public function destroyMessage(Webhook $webhook, WebhookMessage $message): JsonResponse { - Log::channel('audit')->info(sprintf('User destroys webhook #%d, message #%d.', $webhook->id, $message->id)); if ($message->webhook_id !== $webhook->id) { throw new FireflyException('200040: Webhook and webhook message are no match'); } if(false === config('firefly.allow_webhooks')) { + Log::channel('audit')->info(sprintf('User tries to destroy webhook #%d, message #%d, but webhooks are DISABLED.', $webhook->id, $message->id)); throw new NotFoundHttpException('Webhooks are not enabled.'); } + Log::channel('audit')->info(sprintf('User destroys webhook #%d, message #%d.', $webhook->id, $message->id)); $this->repository->destroyMessage($message); app('preferences')->mark(); diff --git a/app/Api/V1/Controllers/Webhook/MessageController.php b/app/Api/V1/Controllers/Webhook/MessageController.php index 2b375dc62d..88a53e98c8 100644 --- a/app/Api/V1/Controllers/Webhook/MessageController.php +++ b/app/Api/V1/Controllers/Webhook/MessageController.php @@ -67,6 +67,7 @@ class MessageController extends Controller public function index(Webhook $webhook): JsonResponse { if(false === config('firefly.allow_webhooks')) { + Log::channel('audit')->info(sprintf('User tries to view messages of webhook #%d, but webhooks are DISABLED.', $webhook->id)); throw new NotFoundHttpException('Webhooks are not enabled.'); } Log::channel('audit')->info(sprintf('User views messages of webhook #%d.', $webhook->id)); @@ -105,6 +106,7 @@ class MessageController extends Controller throw new FireflyException('200040: Webhook and webhook message are no match'); } if(false === config('firefly.allow_webhooks')) { + Log::channel('audit')->info(sprintf('User tries to view message #%d of webhook #%d, but webhooks are DISABLED.', $message->id, $webhook->id)); throw new NotFoundHttpException('Webhooks are not enabled.'); } diff --git a/app/Api/V1/Controllers/Webhook/ShowController.php b/app/Api/V1/Controllers/Webhook/ShowController.php index c51bd5bf1a..34945a09be 100644 --- a/app/Api/V1/Controllers/Webhook/ShowController.php +++ b/app/Api/V1/Controllers/Webhook/ShowController.php @@ -72,6 +72,7 @@ class ShowController extends Controller public function index(): JsonResponse { if(false === config('firefly.allow_webhooks')) { + Log::channel('audit')->info('User tries to view all webhooks, but webhooks are DISABLED.'); throw new NotFoundHttpException('Webhooks are not enabled.'); } @@ -105,6 +106,7 @@ class ShowController extends Controller public function show(Webhook $webhook): JsonResponse { if(false === config('firefly.allow_webhooks')) { + Log::channel('audit')->info(sprintf('User tries to view webhook #%d, but webhooks are DISABLED.', $webhook->id)); throw new NotFoundHttpException('Webhooks are not enabled.'); } @@ -128,6 +130,7 @@ class ShowController extends Controller public function triggerTransaction(Webhook $webhook, TransactionGroup $group): JsonResponse { if(false === config('firefly.allow_webhooks')) { + Log::channel('audit')->info(sprintf('User tries to trigger webhook #%d on transaction group #%d, but webhooks are DISABLED.', $webhook->id, $group->id)); throw new NotFoundHttpException('Webhooks are not enabled.'); } diff --git a/app/Api/V1/Controllers/Webhook/StoreController.php b/app/Api/V1/Controllers/Webhook/StoreController.php index 75d73adbea..aed4847ee9 100644 --- a/app/Api/V1/Controllers/Webhook/StoreController.php +++ b/app/Api/V1/Controllers/Webhook/StoreController.php @@ -59,11 +59,12 @@ class StoreController extends Controller */ public function store(CreateRequest $request): JsonResponse { + $data = $request->getData(); if(false === config('firefly.allow_webhooks')) { + Log::channel('audit')->info('User tries to store new webhook, but webhooks are DISABLED.', $data); throw new NotFoundHttpException('Webhooks are not enabled.'); } - $data = $request->getData(); $webhook = $this->repository->store($data); $manager = $this->getManager(); diff --git a/app/Api/V1/Controllers/Webhook/SubmitController.php b/app/Api/V1/Controllers/Webhook/SubmitController.php index 524f7bc5a6..b65b3edcc4 100644 --- a/app/Api/V1/Controllers/Webhook/SubmitController.php +++ b/app/Api/V1/Controllers/Webhook/SubmitController.php @@ -58,6 +58,7 @@ class SubmitController extends Controller public function submit(Webhook $webhook): JsonResponse { if(false === config('firefly.allow_webhooks')) { + Log::channel('audit')->info(sprintf('User tries to submit webhook #%d, but webhooks are DISABLED.', $webhook->id)); throw new NotFoundHttpException('Webhooks are not enabled.'); } diff --git a/app/Api/V1/Controllers/Webhook/UpdateController.php b/app/Api/V1/Controllers/Webhook/UpdateController.php index 0d773a8f10..3e81b0ee09 100644 --- a/app/Api/V1/Controllers/Webhook/UpdateController.php +++ b/app/Api/V1/Controllers/Webhook/UpdateController.php @@ -59,11 +59,12 @@ class UpdateController extends Controller */ public function update(Webhook $webhook, UpdateRequest $request): JsonResponse { + $data = $request->getData(); if(false === config('firefly.allow_webhooks')) { + Log::channel('audit')->info(sprintf('User tries to update webhook #%d, but webhooks are DISABLED.', $webhook->id), $data); throw new NotFoundHttpException('Webhooks are not enabled.'); } - $data = $request->getData(); $webhook = $this->repository->update($webhook, $data); $manager = $this->getManager(); diff --git a/app/Http/Controllers/Webhooks/CreateController.php b/app/Http/Controllers/Webhooks/CreateController.php index 8b94a92066..fe34a8a19b 100644 --- a/app/Http/Controllers/Webhooks/CreateController.php +++ b/app/Http/Controllers/Webhooks/CreateController.php @@ -59,10 +59,11 @@ class CreateController extends Controller */ public function index() { - Log::channel('audit')->info('User visits webhook create page.'); if(false === config('firefly.allow_webhooks')) { + Log::channel('audit')->info('User visits webhook create page, but webhooks are DISABLED.'); throw new NotFoundHttpException('Webhooks are not enabled.'); } + Log::channel('audit')->info('User visits webhook create page.'); $previousUrl = $this->rememberPreviousUrl('webhooks.create.url'); return view('webhooks.create', compact('previousUrl')); diff --git a/app/Http/Controllers/Webhooks/DeleteController.php b/app/Http/Controllers/Webhooks/DeleteController.php index 08820761be..7b1f303494 100644 --- a/app/Http/Controllers/Webhooks/DeleteController.php +++ b/app/Http/Controllers/Webhooks/DeleteController.php @@ -63,10 +63,11 @@ class DeleteController extends Controller */ public function index(Webhook $webhook) { - Log::channel('audit')->info('User visits webhook delete page.'); if(false === config('firefly.allow_webhooks')) { + Log::channel('audit')->info('User visits webhook delete page, but webhooks are DISABLED.'); throw new NotFoundHttpException('Webhooks are not enabled.'); } + Log::channel('audit')->info('User visits webhook delete page.'); $subTitle = (string)trans('firefly.delete_webhook', ['title' => $webhook->title]); $this->rememberPreviousUrl('webhooks.delete.url'); diff --git a/app/Http/Controllers/Webhooks/EditController.php b/app/Http/Controllers/Webhooks/EditController.php index c122a60291..42547978bc 100644 --- a/app/Http/Controllers/Webhooks/EditController.php +++ b/app/Http/Controllers/Webhooks/EditController.php @@ -62,10 +62,11 @@ class EditController extends Controller */ public function index(Webhook $webhook) { - Log::channel('audit')->info('User visits webhook edit page.'); if(false === config('firefly.allow_webhooks')) { + Log::channel('audit')->info('User visits webhook edit page, but webhooks are DISABLED.'); throw new NotFoundHttpException('Webhooks are not enabled.'); } + Log::channel('audit')->info('User visits webhook edit page.'); $subTitle = (string)trans('firefly.edit_webhook', ['title' => $webhook->title]); $this->rememberPreviousUrl('webhooks.edit.url'); diff --git a/app/Http/Controllers/Webhooks/IndexController.php b/app/Http/Controllers/Webhooks/IndexController.php index c1e58ae82f..0060615604 100644 --- a/app/Http/Controllers/Webhooks/IndexController.php +++ b/app/Http/Controllers/Webhooks/IndexController.php @@ -55,10 +55,11 @@ class IndexController extends Controller */ public function index() { - Log::channel('audit')->info('User visits webhook index page.'); if(false === config('firefly.allow_webhooks')) { + Log::channel('audit')->info('User visits webhook index page, but webhooks are DISABLED.'); throw new NotFoundHttpException('Webhooks are not enabled.'); } + Log::channel('audit')->info('User visits webhook index page.'); return view('webhooks.index'); } diff --git a/app/Http/Controllers/Webhooks/ShowController.php b/app/Http/Controllers/Webhooks/ShowController.php index 04c91333cd..993178a5ec 100644 --- a/app/Http/Controllers/Webhooks/ShowController.php +++ b/app/Http/Controllers/Webhooks/ShowController.php @@ -62,10 +62,11 @@ class ShowController extends Controller */ public function index(Webhook $webhook) { - Log::channel('audit')->info(sprintf('User visits webhook #%d page.', $webhook->id)); if(false === config('firefly.allow_webhooks')) { + Log::channel('audit')->info(sprintf('User visits webhook #%d page, but webhooks are DISABLED.', $webhook->id)); throw new NotFoundHttpException('Webhooks are not enabled.'); } + Log::channel('audit')->info(sprintf('User visits webhook #%d page.', $webhook->id)); $subTitle = (string)trans('firefly.show_webhook', ['title' => $webhook->title]); return view('webhooks.show', compact('webhook', 'subTitle'));