fix: root team able to download backups
This commit is contained in:
parent
6f3e38e392
commit
64f8583975
@ -254,14 +254,16 @@
|
|||||||
$exeuctionId = request()->route('executionId');
|
$exeuctionId = request()->route('executionId');
|
||||||
$execution = ScheduledDatabaseBackupExecution::where('id', $exeuctionId)->firstOrFail();
|
$execution = ScheduledDatabaseBackupExecution::where('id', $exeuctionId)->firstOrFail();
|
||||||
$execution_team_id = $execution->scheduledDatabaseBackup->database->team()?->id;
|
$execution_team_id = $execution->scheduledDatabaseBackup->database->team()?->id;
|
||||||
if (is_null($execution_team_id)) {
|
if ($team->id !== 0) {
|
||||||
return response()->json(['message' => 'Team not found.'], 404);
|
if (is_null($execution_team_id)) {
|
||||||
}
|
return response()->json(['message' => 'Team not found.'], 404);
|
||||||
if ($team->id !== $execution_team_id) {
|
}
|
||||||
return response()->json(['message' => 'Permission denied.'], 403);
|
if ($team->id !== $execution_team_id) {
|
||||||
}
|
return response()->json(['message' => 'Permission denied.'], 403);
|
||||||
if (is_null($execution)) {
|
}
|
||||||
return response()->json(['message' => 'Backup not found.'], 404);
|
if (is_null($execution)) {
|
||||||
|
return response()->json(['message' => 'Backup not found.'], 404);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$filename = data_get($execution, 'filename');
|
$filename = data_get($execution, 'filename');
|
||||||
if ($execution->scheduledDatabaseBackup->database->getMorphClass() === 'App\Models\ServiceDatabase') {
|
if ($execution->scheduledDatabaseBackup->database->getMorphClass() === 'App\Models\ServiceDatabase') {
|
||||||
|
Loading…
Reference in New Issue
Block a user