Skip to content

Commit

Permalink
Check model view policy on related records pages
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanmitchell committed Aug 16, 2024
1 parent 02d2852 commit 72f418e
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public static function canAccess(array $parameters = []): bool
$model = $record->{static::getRelationshipName()}()->getQuery()->getModel()::class;

try {
return authorize('viewAny', $model, static::shouldCheckPolicyExistence())->allowed();
return authorize('view', $record, static::shouldCheckPolicyExistence())->allowed() && authorize('viewAny', $model, static::shouldCheckPolicyExistence())->allowed();
} catch (AuthorizationException $exception) {
return $exception->toResponse()->allowed();
}
Expand Down

0 comments on commit 72f418e

Please sign in to comment.