From 99a355145ea7584abfac3f5f6d354ee211d65a4e Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 7 Nov 2017 22:24:57 -0800 Subject: [PATCH 1/4] Removed empty comments --- app/Policies/SnipePermissionsPolicy.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/app/Policies/SnipePermissionsPolicy.php b/app/Policies/SnipePermissionsPolicy.php index 55d2a5032b..d0aac0eca6 100644 --- a/app/Policies/SnipePermissionsPolicy.php +++ b/app/Policies/SnipePermissionsPolicy.php @@ -26,7 +26,6 @@ abstract class SnipePermissionsPolicy public function index(User $user) { - // dd('here'); return $user->hasAccess($this->columnName().'.view'); } /** @@ -37,7 +36,6 @@ abstract class SnipePermissionsPolicy */ public function view(User $user, $item = null) { - // return $user->hasAccess($this->columnName().'.view'); } @@ -49,7 +47,6 @@ abstract class SnipePermissionsPolicy */ public function create(User $user) { - // return $user->hasAccess($this->columnName().'.create'); } @@ -61,7 +58,6 @@ abstract class SnipePermissionsPolicy */ public function update(User $user, $item = null) { - // return $user->hasAccess($this->columnName().'.edit'); } @@ -73,7 +69,6 @@ abstract class SnipePermissionsPolicy */ public function delete(User $user, $item = null) { - // return $user->hasAccess($this->columnName().'.delete'); } From d03b8c6528fdced41a5347945c301fb3f4ed0bf7 Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 7 Nov 2017 22:25:24 -0800 Subject: [PATCH 2/4] Error handling for when log ID has no match on asset accept --- app/Http/Controllers/ViewAssetsController.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/ViewAssetsController.php b/app/Http/Controllers/ViewAssetsController.php index 6c112ff657..2aa5286757 100755 --- a/app/Http/Controllers/ViewAssetsController.php +++ b/app/Http/Controllers/ViewAssetsController.php @@ -284,9 +284,10 @@ class ViewAssetsController extends Controller public function getAcceptAsset($logID = null) { - if (!$findlog = Actionlog::where('id', $logID)->first()) { - echo 'no record'; - //return redirect()->to('account')->with('error', trans('admin/hardware/message.does_not_exist')); + $findlog = Actionlog::where('id', $logID)->first(); + + if (!$findlog) { + return redirect()->to('account/view-assets')->with('error', 'No matching record.'); } if ($findlog->accepted_id!='') { From 9764d2ad24c8e509c2009f8e6d893c6f6b8132f7 Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 7 Nov 2017 22:25:32 -0800 Subject: [PATCH 3/4] Removed commented code --- app/Http/Controllers/Api/ConsumablesController.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/Http/Controllers/Api/ConsumablesController.php b/app/Http/Controllers/Api/ConsumablesController.php index e4f5a7b516..7a41c9ec41 100644 --- a/app/Http/Controllers/Api/ConsumablesController.php +++ b/app/Http/Controllers/Api/ConsumablesController.php @@ -160,7 +160,6 @@ class ConsumablesController extends Controller */ public function getDataView($consumableId) { - //$consumable = Consumable::find($consumableID); $consumable = Consumable::with(array('consumableAssignments'=> function ($query) { $query->orderBy('created_at', 'DESC'); @@ -171,8 +170,6 @@ class ConsumablesController extends Controller }, ))->find($consumableId); - // $consumable->load('consumableAssignments.admin','consumableAssignments.user'); - if (!Company::isCurrentUserHasAccess($consumable)) { return ['total' => 0, 'rows' => []]; } From 74773ac912fa567b01ce8438a68ec22535dba4b6 Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 7 Nov 2017 23:05:29 -0800 Subject: [PATCH 4/4] Fixed incorrect policy reference in consumables listing --- app/Http/Controllers/Api/ConsumablesController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/Api/ConsumablesController.php b/app/Http/Controllers/Api/ConsumablesController.php index 7a41c9ec41..3c1184d38b 100644 --- a/app/Http/Controllers/Api/ConsumablesController.php +++ b/app/Http/Controllers/Api/ConsumablesController.php @@ -173,7 +173,7 @@ class ConsumablesController extends Controller if (!Company::isCurrentUserHasAccess($consumable)) { return ['total' => 0, 'rows' => []]; } - $this->authorize('view', Component::class); + $this->authorize('view', Consumable::class); $rows = array(); foreach ($consumable->consumableAssignments as $consumable_assignment) {