Fix error causing tasks to be un-deletable.

closes #786
This commit is contained in:
Dane Everitt 2017-12-01 20:10:06 -06:00
parent 47f2ca0673
commit 20beb2f280
3 changed files with 3 additions and 5 deletions

View file

@ -51,5 +51,5 @@ return PhpCsFixer\Config::create()
'equal' => false, 'equal' => false,
'identical' => false, 'identical' => false,
'less_and_greater' => false, 'less_and_greater' => false,
] ],
])->setRiskyAllowed(true)->setFinder($finder); ])->setRiskyAllowed(true)->setFinder($finder);

View file

@ -149,8 +149,6 @@ class TaskManagementController extends Controller
* *
* @param \Pterodactyl\Http\Requests\Server\ScheduleCreationFormRequest $request * @param \Pterodactyl\Http\Requests\Server\ScheduleCreationFormRequest $request
* @return \Illuminate\Http\RedirectResponse * @return \Illuminate\Http\RedirectResponse
*
* @throws \Illuminate\Auth\Access\AuthorizationException
*/ */
public function update(ScheduleCreationFormRequest $request): RedirectResponse public function update(ScheduleCreationFormRequest $request): RedirectResponse
{ {
@ -177,7 +175,7 @@ class TaskManagementController extends Controller
*/ */
public function delete(Request $request): Response public function delete(Request $request): Response
{ {
$server = $request->attributes->get('server_data.model'); $server = $request->attributes->get('server');
$schedule = $request->attributes->get('schedule'); $schedule = $request->attributes->get('schedule');
$this->authorize('delete-schedule', $server); $this->authorize('delete-schedule', $server);

View file

@ -49,7 +49,7 @@ class ScheduleBelongsToServer
$scheduleId = $this->hashids->decodeFirst($request->route()->parameter('schedule'), 0); $scheduleId = $this->hashids->decodeFirst($request->route()->parameter('schedule'), 0);
$schedule = $this->repository->getScheduleWithTasks($scheduleId); $schedule = $this->repository->getScheduleWithTasks($scheduleId);
if (object_get($schedule, 'server_id') !== $server->id) { if ($schedule->server_id !== $server->id) {
throw new NotFoundHttpException; throw new NotFoundHttpException;
} }