fix: root team able to download backups

This commit is contained in:
Andras Bacsai 2024-05-24 09:33:09 +02:00
parent 6f3e38e392
commit 64f8583975

View File

@ -254,6 +254,7 @@
$exeuctionId = request()->route('executionId');
$execution = ScheduledDatabaseBackupExecution::where('id', $exeuctionId)->firstOrFail();
$execution_team_id = $execution->scheduledDatabaseBackup->database->team()?->id;
if ($team->id !== 0) {
if (is_null($execution_team_id)) {
return response()->json(['message' => 'Team not found.'], 404);
}
@ -263,6 +264,7 @@
if (is_null($execution)) {
return response()->json(['message' => 'Backup not found.'], 404);
}
}
$filename = data_get($execution, 'filename');
if ($execution->scheduledDatabaseBackup->database->getMorphClass() === 'App\Models\ServiceDatabase') {
$server = $execution->scheduledDatabaseBackup->database->service->destination->server;