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
871 B
PHP
32 lines
871 B
PHP
<?php
|
|
|
|
namespace App\Livewire\Security\PrivateKey;
|
|
|
|
use App\Models\PrivateKey;
|
|
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
|
use Livewire\Component;
|
|
|
|
class Index extends Component
|
|
{
|
|
use AuthorizesRequests;
|
|
|
|
public function render()
|
|
{
|
|
$privateKeys = PrivateKey::ownedByCurrentTeam(['name', 'uuid', 'is_git_related', 'description', 'team_id'])->get();
|
|
|
|
return view('livewire.security.private-key.index', [
|
|
'privateKeys' => $privateKeys,
|
|
])->layout('components.layout');
|
|
}
|
|
|
|
public function cleanupUnusedKeys()
|
|
{
|
|
try {
|
|
$this->authorize('create', PrivateKey::class);
|
|
PrivateKey::cleanupUnusedKeys();
|
|
$this->dispatch('success', 'Unused keys have been cleaned up.');
|
|
} catch (\Throwable $e) {
|
|
return handleError($e, $this);
|
|
}
|
|
}
|
|
}
|