diff --git a/app/Livewire/Project/Database/Import.php b/app/Livewire/Project/Database/Import.php index 402c96db0..fe30b6f67 100644 --- a/app/Livewire/Project/Database/Import.php +++ b/app/Livewire/Project/Database/Import.php @@ -300,14 +300,7 @@ public function checkS3File() } try { - $s3Storage = S3Storage::findOrFail($this->s3StorageId); - - // Verify S3 belongs to current team - if ($s3Storage->team_id !== currentTeam()->id) { - $this->dispatch('error', 'You do not have permission to access this S3 storage.'); - - return; - } + $s3Storage = S3Storage::ownedByCurrentTeam()->findOrFail($this->s3StorageId); // Test connection $s3Storage->testConnection(); @@ -363,14 +356,7 @@ public function downloadFromS3() try { $this->s3DownloadInProgress = true; - $s3Storage = S3Storage::findOrFail($this->s3StorageId); - - // Verify S3 belongs to current team - if ($s3Storage->team_id !== currentTeam()->id) { - $this->dispatch('error', 'You do not have permission to access this S3 storage.'); - - return; - } + $s3Storage = S3Storage::ownedByCurrentTeam()->findOrFail($this->s3StorageId); $key = $s3Storage->key; $secret = $s3Storage->secret; diff --git a/resources/views/livewire/project/database/import.blade.php b/resources/views/livewire/project/database/import.blade.php index eb085be5b..be5b0f00a 100644 --- a/resources/views/livewire/project/database/import.blade.php +++ b/resources/views/livewire/project/database/import.blade.php @@ -6,52 +6,53 @@ progress: $wire.entangle('progress'), s3DownloadInProgress: $wire.entangle('s3DownloadInProgress'), s3DownloadedFile: $wire.entangle('s3DownloadedFile'), - s3FileSize: $wire.entangle('s3FileSize') + s3FileSize: $wire.entangle('s3FileSize'), + s3StorageId: $wire.entangle('s3StorageId'), + s3Path: $wire.entangle('s3Path') }"> @script - + @endscript

Import Backup

@if ($unsupported)
Database restore is not supported.
@else
- + @@ -71,8 +72,7 @@
@endif
- +
@elseif ($resource->type() === 'standalone-mysql') @if ($dumpAll) @@ -82,8 +82,7 @@ @endif
- +
@elseif ($resource->type() === 'standalone-mariadb') @if ($dumpAll) @@ -93,14 +92,13 @@ @endif
- +
@endif

Backup File

- + Check File
@@ -135,8 +133,7 @@ placeholder="/backups/database-backup.gz" wire:model='s3Path'>
- + Check File
@@ -182,4 +179,4 @@
Database must be running to restore a backup.
@endif @endif -
+ \ No newline at end of file