From c4dbdef5020e1a1dc0245e261e1945c147801e7d Mon Sep 17 00:00:00 2001 From: Nathan Curtis Date: Mon, 15 Apr 2024 13:26:06 -0700 Subject: [PATCH] [TM-812] Use can instead of hasPermissionTo, as it doesn't throw an error when the permission isn't found. --- app/Http/Controllers/Traits/IsAdminIndex.php | 2 +- .../V2/UpdateRequests/AdminIndexUpdateRequestsController.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Traits/IsAdminIndex.php b/app/Http/Controllers/Traits/IsAdminIndex.php index e97cfb75f..743a67d3b 100644 --- a/app/Http/Controllers/Traits/IsAdminIndex.php +++ b/app/Http/Controllers/Traits/IsAdminIndex.php @@ -33,7 +33,7 @@ protected function isolateAuthorizedFrameworks(QueryBuilder $query, string $tabl $query->where(function ($query) use ($tableName, $frameworkNames, $user) { foreach ($frameworkNames as $framework) { $frameworkPermission = 'framework-' . $framework; - if ($user->hasPermissionTo($frameworkPermission)) { + if ($user->can($frameworkPermission)) { $query->orWhere("$tableName.framework_key", $framework); } } diff --git a/app/Http/Controllers/V2/UpdateRequests/AdminIndexUpdateRequestsController.php b/app/Http/Controllers/V2/UpdateRequests/AdminIndexUpdateRequestsController.php index ce22e4719..68ee42ce0 100644 --- a/app/Http/Controllers/V2/UpdateRequests/AdminIndexUpdateRequestsController.php +++ b/app/Http/Controllers/V2/UpdateRequests/AdminIndexUpdateRequestsController.php @@ -59,7 +59,7 @@ public function __invoke(Request $request): UpdateRequestsCollection $query->where(function ($query) use ($frameworkNames, $user) { foreach ($frameworkNames as $framework) { $frameworkPermission = 'framework-' . $framework; - if ($user->hasPermissionTo($frameworkPermission)) { + if ($user->can($frameworkPermission)) { $query->orWhere('framework_key', $framework); } }