From d373815f989bdddbfb897454e906aa4b514fb380 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Tue, 17 Sep 2024 16:28:28 +0200 Subject: [PATCH] refactor: Add authorization check in ExecuteContainerCommand mount method --- app/Livewire/Project/Shared/ExecuteContainerCommand.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Livewire/Project/Shared/ExecuteContainerCommand.php b/app/Livewire/Project/Shared/ExecuteContainerCommand.php index 79f32ab8b..d95443621 100644 --- a/app/Livewire/Project/Shared/ExecuteContainerCommand.php +++ b/app/Livewire/Project/Shared/ExecuteContainerCommand.php @@ -33,6 +33,9 @@ class ExecuteContainerCommand extends Component public function mount() { + if (! auth()->user()->isAdmin()) { + abort(403); + } $this->parameters = get_route_parameters(); $this->containers = collect(); $this->servers = collect(); @@ -130,7 +133,6 @@ class ExecuteContainerCommand extends Component { try { $container_name = data_get($this->container, 'container.Names'); - ray($this->container); if (is_null($container_name)) { throw new \RuntimeException('Container not found.'); }