diff --git a/app/Http/Controllers/Api/ConsumablesController.php b/app/Http/Controllers/Api/ConsumablesController.php index e4f5a7b516..3c1184d38b 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,12 +170,10 @@ class ConsumablesController extends Controller }, ))->find($consumableId); - // $consumable->load('consumableAssignments.admin','consumableAssignments.user'); - 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) { 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!='') { 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'); }