From f90271dae52cfd09e23a35ca338b2afc9c1036d2 Mon Sep 17 00:00:00 2001 From: snipe Date: Fri, 8 Dec 2017 14:33:12 -0800 Subject: [PATCH] Aaaaand one more for #2810. Sigh. --- app/Http/Controllers/LicensesController.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/LicensesController.php b/app/Http/Controllers/LicensesController.php index 9608fdb56..559f979fa 100755 --- a/app/Http/Controllers/LicensesController.php +++ b/app/Http/Controllers/LicensesController.php @@ -362,7 +362,14 @@ class LicensesController extends Controller // Redirect to the asset management page with error return redirect()->route('licenses.index')->with('error', trans('admin/licenses/message.not_found')); } - $this->authorize('checkin', $licenseSeat); + + if (is_null($license = License::find($licenseSeat->license_id))) { + // Redirect to the asset management page with error + return redirect()->route('licenses.index')->with('error', trans('admin/licenses/message.not_found')); + } + + + $this->authorize('checkout', $license); return view('licenses/checkin', compact('licenseSeat'))->with('backto', $backTo); } @@ -386,8 +393,7 @@ class LicensesController extends Controller } $license = License::find($licenseSeat->license_id); - - $this->authorize('checkin', $license); + $this->authorize('checkout', $license); if (!$license->reassignable) { // Not allowed to checkin