From f1c63de8c0b5a213d06fbdd7f3c81f7f2c4f5849 Mon Sep 17 00:00:00 2001 From: Yasen Pramatarov Date: Tue, 7 Jan 2025 21:31:07 +0200 Subject: [PATCH] Logs access fixes --- app/pages/logs.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/pages/logs.php b/app/pages/logs.php index 66138ca..79faa0d 100644 --- a/app/pages/logs.php +++ b/app/pages/logs.php @@ -7,6 +7,14 @@ * It supports pagination and filtering, and generates a widget to display the logs. */ +// Check for rights; user or system +if (($userObject->hasRight($user_id, 'superuser') || + $userObject->hasRight($user_id, 'view app logs'))) { + $scope = 'system'; +} else { + $scope = 'user'; +} + // specify time range include '../app/helpers/time_range.php'; @@ -16,9 +24,6 @@ $browse_page = $_REQUEST['p'] ?? 1; $browse_page = (int)$browse_page; $offset = ($browse_page -1) * $items_per_page; -// logs scope: user or system -$scope = 'user'; - // prepare the result $search = $logObject->readLog($user_id, $scope, $offset, $items_per_page); $search_all = $logObject->readLog($user_id, $scope);