refactor: Add authorization check in ExecuteContainerCommand mount method
This commit is contained in:
@@ -33,6 +33,9 @@ class ExecuteContainerCommand extends Component
|
|||||||
|
|
||||||
public function mount()
|
public function mount()
|
||||||
{
|
{
|
||||||
|
if (! auth()->user()->isAdmin()) {
|
||||||
|
abort(403);
|
||||||
|
}
|
||||||
$this->parameters = get_route_parameters();
|
$this->parameters = get_route_parameters();
|
||||||
$this->containers = collect();
|
$this->containers = collect();
|
||||||
$this->servers = collect();
|
$this->servers = collect();
|
||||||
@@ -130,7 +133,6 @@ class ExecuteContainerCommand extends Component
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$container_name = data_get($this->container, 'container.Names');
|
$container_name = data_get($this->container, 'container.Names');
|
||||||
ray($this->container);
|
|
||||||
if (is_null($container_name)) {
|
if (is_null($container_name)) {
|
||||||
throw new \RuntimeException('Container not found.');
|
throw new \RuntimeException('Container not found.');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user