From c0ef27fc9ece305d98aa13e8657ad38a01e0b379 Mon Sep 17 00:00:00 2001 From: snipe Date: Wed, 11 May 2022 19:02:11 -0700 Subject: [PATCH 1/2] =?UTF-8?q?Removed=20kit=20checkout=20permission=20-?= =?UTF-8?q?=20it=E2=80=99s=20just=20confusing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: snipe --- config/permissions.php | 7 ------- 1 file changed, 7 deletions(-) diff --git a/config/permissions.php b/config/permissions.php index 0176dc13ba..2dbe34b2c1 100644 --- a/config/permissions.php +++ b/config/permissions.php @@ -292,13 +292,6 @@ return array( 'note' => '', 'display' => true, ), - - array( - 'permission' => 'kits.checkout', - 'label' => 'Checkout ', - 'note' => '', - 'display' => true, - ), ), From c52faaf23d3dd46aa1f793aaf3a080ee84ad3373 Mon Sep 17 00:00:00 2001 From: snipe Date: Wed, 11 May 2022 19:02:23 -0700 Subject: [PATCH 2/2] Added checkout to permissions check Signed-off-by: snipe --- app/Http/Controllers/Kits/CheckoutKitController.php | 1 + app/Policies/SnipePermissionsPolicy.php | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/app/Http/Controllers/Kits/CheckoutKitController.php b/app/Http/Controllers/Kits/CheckoutKitController.php index 0d99560751..4452d9cc34 100644 --- a/app/Http/Controllers/Kits/CheckoutKitController.php +++ b/app/Http/Controllers/Kits/CheckoutKitController.php @@ -4,6 +4,7 @@ namespace App\Http\Controllers\Kits; use App\Http\Controllers\CheckInOutRequest; use App\Http\Controllers\Controller; use App\Models\PredefinedKit; +use App\Models\Asset; use App\Models\PredefinedLicence; use App\Models\PredefinedModel; use App\Models\User; diff --git a/app/Policies/SnipePermissionsPolicy.php b/app/Policies/SnipePermissionsPolicy.php index 435828fd14..979fc85359 100644 --- a/app/Policies/SnipePermissionsPolicy.php +++ b/app/Policies/SnipePermissionsPolicy.php @@ -83,6 +83,18 @@ abstract class SnipePermissionsPolicy return $user->hasAccess($this->columnName().'.edit'); } + + /** + * Determine whether the user can update the accessory. + * + * @param \App\Models\User $user + * @return mixed + */ + public function checkout(User $user, $item = null) + { + return $user->hasAccess($this->columnName().'.checkout'); + } + /** * Determine whether the user can delete the accessory. *