mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig-portal.git
synced 2025-12-11 06:46:47 +00:00
horizon secret
This commit is contained in:
@@ -12,6 +12,6 @@ class VerifyCsrfToken extends Middleware
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $except = [
|
||||
//
|
||||
'horizon/*',
|
||||
];
|
||||
}
|
||||
|
||||
@@ -28,8 +28,12 @@ class HorizonServiceProvider extends HorizonApplicationServiceProvider
|
||||
*/
|
||||
protected function gate(): void
|
||||
{
|
||||
Gate::define('viewHorizon', function ($user) {
|
||||
return $user->hasRole('super-admin');
|
||||
Gate::define('viewHorizon', function ($user = null) {
|
||||
if (empty($user)) {
|
||||
return request()->bearerToken() === config('services.horizon.secret');
|
||||
} else {
|
||||
return $user->hasRole('horizon-admin');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user