From 27f47d583c95b4ea7cf173ebfcc18c721ac39631 Mon Sep 17 00:00:00 2001 From: alexwenz Date: Thu, 29 Oct 2026 10:41:16 +0100 Subject: [PATCH] Lazy-Block-API nur mit Berechtigung statistics[] aufrufbar Co-Authored-By: Claude Opus 5.5 --- lib/rex_api_statistics_lazy_block.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/rex_api_statistics_lazy_block.php b/lib/rex_api_statistics_lazy_block.php index ef11a22..7822e91 100644 --- a/lib/rex_api_statistics_lazy_block.php +++ b/lib/rex_api_statistics_lazy_block.php @@ -16,6 +16,14 @@ public function execute() rex_response::cleanOutputBuffers(); rex_response::sendContentType('application/json; charset=utf-8'); + // Gleiche Berechtigung wie die Statistik-Seiten (package.yml), nicht nur "eingeloggt" + $user = rex::getUser(); + if (null === $user || !$user->hasPerm('statistics[]')) { + rex_response::setStatus(rex_response::HTTP_FORBIDDEN); + rex_response::sendJson(['error' => 'Permission denied']); + exit; + } + if (!in_array($blockId, ['device', 'device-hourly', 'extended', 'extended-pagecount', 'extended-visitduration', 'extended-lastpage', 'extended-country', 'bots', 'main-daily-tables', 'main-monthly-tables', 'main-yearly-tables', 'main-monthly-chart', 'main-yearly-chart'], true)) { rex_response::setStatus(rex_response::HTTP_BAD_REQUEST); rex_response::sendJson(['error' => 'Unknown block id']);