From 20beb2f2808f4beb07a9e1601c14f908b7c9aa06 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Fri, 1 Dec 2017 20:10:06 -0600 Subject: [PATCH] Fix error causing tasks to be un-deletable. closes #786 --- .php_cs | 2 +- .../Controllers/Server/Tasks/TaskManagementController.php | 4 +--- app/Http/Middleware/Server/ScheduleBelongsToServer.php | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.php_cs b/.php_cs index c2bbfe8c6..c854af47c 100644 --- a/.php_cs +++ b/.php_cs @@ -51,5 +51,5 @@ return PhpCsFixer\Config::create() 'equal' => false, 'identical' => false, 'less_and_greater' => false, - ] + ], ])->setRiskyAllowed(true)->setFinder($finder); diff --git a/app/Http/Controllers/Server/Tasks/TaskManagementController.php b/app/Http/Controllers/Server/Tasks/TaskManagementController.php index e61a560fa..9e6782e93 100644 --- a/app/Http/Controllers/Server/Tasks/TaskManagementController.php +++ b/app/Http/Controllers/Server/Tasks/TaskManagementController.php @@ -149,8 +149,6 @@ class TaskManagementController extends Controller * * @param \Pterodactyl\Http\Requests\Server\ScheduleCreationFormRequest $request * @return \Illuminate\Http\RedirectResponse - * - * @throws \Illuminate\Auth\Access\AuthorizationException */ public function update(ScheduleCreationFormRequest $request): RedirectResponse { @@ -177,7 +175,7 @@ class TaskManagementController extends Controller */ public function delete(Request $request): Response { - $server = $request->attributes->get('server_data.model'); + $server = $request->attributes->get('server'); $schedule = $request->attributes->get('schedule'); $this->authorize('delete-schedule', $server); diff --git a/app/Http/Middleware/Server/ScheduleBelongsToServer.php b/app/Http/Middleware/Server/ScheduleBelongsToServer.php index f9f40bf3b..26da5f843 100644 --- a/app/Http/Middleware/Server/ScheduleBelongsToServer.php +++ b/app/Http/Middleware/Server/ScheduleBelongsToServer.php @@ -49,7 +49,7 @@ class ScheduleBelongsToServer $scheduleId = $this->hashids->decodeFirst($request->route()->parameter('schedule'), 0); $schedule = $this->repository->getScheduleWithTasks($scheduleId); - if (object_get($schedule, 'server_id') !== $server->id) { + if ($schedule->server_id !== $server->id) { throw new NotFoundHttpException; }