Skip to content

Commit 7ecc23f

Browse files
committed
fixes to reporting system
1 parent b5fe26a commit 7ecc23f

File tree

6 files changed

+402
-154
lines changed

6 files changed

+402
-154
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "fleetbase/core-api",
3-
"version": "1.6.17",
3+
"version": "1.6.18",
44
"description": "Core Framework and Resources for Fleetbase API",
55
"keywords": [
66
"fleetbase",

src/Http/Controllers/Internal/v1/ReportController.php

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -198,17 +198,6 @@ public function execute(Request $request, string $id): JsonResponse
198198
try {
199199
$report = Report::where('uuid', $id)->firstOrFail();
200200

201-
// Check permissions
202-
if (!$this->canAccessReport($report)) {
203-
return response()->json([
204-
'success' => false,
205-
'error' => [
206-
'code' => 'PERMISSION_DENIED',
207-
'message' => 'Access denied to this report',
208-
],
209-
], 403);
210-
}
211-
212201
// Validate query configuration before execution
213202
$validationResult = $this->queryValidator->validate($report->query_config);
214203
if (!$validationResult['valid']) {
@@ -325,19 +314,7 @@ public function executeQuery(Request $request): JsonResponse
325314
public function export(Request $request, string $id): JsonResponse
326315
{
327316
try {
328-
$report = Report::where('uuid', $id)->firstOrFail();
329-
330-
// Check permissions
331-
if (!$this->canAccessReport($report)) {
332-
return response()->json([
333-
'success' => false,
334-
'error' => [
335-
'code' => 'PERMISSION_DENIED',
336-
'message' => 'Access denied to this report',
337-
],
338-
], 403);
339-
}
340-
317+
$report = Report::where('uuid', $id)->firstOrFail();
341318
$format = $request->input('format', 'csv');
342319
$options = $request->input('options', []);
343320

src/Providers/CoreServiceProvider.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Fleetbase\Models\Setting;
66
use Fleetbase\Support\EnvironmentMapper;
77
use Fleetbase\Support\NotificationRegistry;
8+
use Fleetbase\Support\Reporting\ReportSchemaRegistry;
89
use Fleetbase\Support\Telemetry;
910
use Fleetbase\Support\Utils;
1011
use Illuminate\Console\Scheduling\Schedule;
@@ -123,6 +124,11 @@ public function register()
123124
$this->mergeConfigFrom(__DIR__ . '/../../config/sentry.php', 'sentry');
124125
$this->mergeConfigFrom(__DIR__ . '/../../config/laravel-mysql-s3-backup.php', 'laravel-mysql-s3-backup');
125126
$this->mergeConfigFrom(__DIR__ . '/../../config/responsecache.php', 'responsecache');
127+
128+
// setup report schema registry
129+
$this->app->singleton(ReportSchemaRegistry::class, function () {
130+
return new ReportSchemaRegistry();
131+
});
126132
}
127133

128134
/**

0 commit comments

Comments
 (0)