Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamincrozat committed Oct 25, 2023
1 parent 5c7fdd0 commit 853315a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
8 changes: 7 additions & 1 deletion app/Providers/HorizonServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ class HorizonServiceProvider extends HorizonApplicationServiceProvider
{
protected function gate() : void
{
Gate::define('viewHorizon', fn () => true);
Gate::define('viewHorizon', function ($user = null) {
if (request()->bearerToken() && request()->bearerToken() === config('services.horizon.token')) {
return true;
}

return 1 === $user->id;
});
}
}
4 changes: 3 additions & 1 deletion config/cors.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
|
*/

'paths' => ['api/*', 'sanctum/csrf-cookie'],
'paths' => [
'horizon/*',
],

'allowed_methods' => ['*'],

Expand Down
2 changes: 2 additions & 0 deletions config/horizon.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,4 +215,6 @@
],
],
],

'token' => env('HORIZON_TOKEN'),
];

0 comments on commit 853315a

Please sign in to comment.