Skip to content

Commit

Permalink
[TM-812] Use can instead of hasPermissionTo, as it doesn't throw an e…
Browse files Browse the repository at this point in the history
…rror when the permission isn't found.
  • Loading branch information
roguenet committed Apr 15, 2024
1 parent 3a466c3 commit c4dbdef
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/Http/Controllers/Traits/IsAdminIndex.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down

0 comments on commit c4dbdef

Please sign in to comment.