mirror of
https://github.com/coollabsio/coolify.git
synced 2026-03-11 08:55:47 +00:00
- Add authorization checks to API controller endpoints (view, create, update, delete) - Wrap Livewire component methods with try-catch for consistent error handling - Add AuthorizesRequests trait to components requiring authorization checks - Ensure all sensitive operations verify user permissions before execution - Implement unified error handling with handleError() helper function
32 lines
756 B
PHP
32 lines
756 B
PHP
<?php
|
|
|
|
namespace App\Livewire\Storage;
|
|
|
|
use App\Models\S3Storage;
|
|
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
|
use Livewire\Component;
|
|
|
|
class Show extends Component
|
|
{
|
|
use AuthorizesRequests;
|
|
|
|
public $storage = null;
|
|
|
|
public function mount()
|
|
{
|
|
$this->storage = S3Storage::ownedByCurrentTeam()->whereUuid(request()->storage_uuid)->first();
|
|
if (! $this->storage) {
|
|
abort(404);
|
|
}
|
|
try {
|
|
$this->authorize('view', $this->storage);
|
|
} catch (\Illuminate\Auth\Access\AuthorizationException) {
|
|
return $this->redirectRoute('storage.index', navigate: true);
|
|
}
|
|
}
|
|
|
|
public function render()
|
|
{
|
|
return view('livewire.storage.show');
|
|
}
|
|
}
|