feat(auth): implement authorization for Docker and server management
- Added authorization checks in Livewire components related to Docker and server management to ensure only authorized users can create, update, and manage Docker instances and server settings. - Introduced new policies for StandaloneDocker and SwarmDocker to define access control rules based on user roles and team associations. - Updated AuthServiceProvider to register the new policies, enhancing security and access control for Docker functionalities and server management operations.
This commit is contained in:
@@ -5,6 +5,7 @@ namespace App\Livewire\Destination\New;
|
||||
use App\Models\Server;
|
||||
use App\Models\StandaloneDocker;
|
||||
use App\Models\SwarmDocker;
|
||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||
use Livewire\Attributes\Locked;
|
||||
use Livewire\Attributes\Validate;
|
||||
use Livewire\Component;
|
||||
@@ -12,6 +13,8 @@ use Visus\Cuid2\Cuid2;
|
||||
|
||||
class Docker extends Component
|
||||
{
|
||||
use AuthorizesRequests;
|
||||
|
||||
#[Locked]
|
||||
public $servers;
|
||||
|
||||
@@ -67,6 +70,7 @@ class Docker extends Component
|
||||
public function submit()
|
||||
{
|
||||
try {
|
||||
$this->authorize('create', StandaloneDocker::class);
|
||||
$this->validate();
|
||||
if ($this->isSwarm) {
|
||||
$found = $this->selectedServer->swarmDockers()->where('network', $this->network)->first();
|
||||
|
||||
Reference in New Issue
Block a user