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');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ return [
|
||||
|
|
||||
*/
|
||||
|
||||
'paths' => ['api/*', 'sanctum/csrf-cookie'],
|
||||
'paths' => ['api/*', 'sanctum/csrf-cookie', 'horizon/*'],
|
||||
|
||||
'allowed_methods' => ['*'],
|
||||
|
||||
|
||||
@@ -14,6 +14,10 @@ return [
|
||||
|
|
||||
*/
|
||||
|
||||
'horizon' => [
|
||||
'secret' => env('HORIZON_SECRET'),
|
||||
],
|
||||
|
||||
'mailgun' => [
|
||||
'domain' => env('MAILGUN_DOMAIN'),
|
||||
'secret' => env('MAILGUN_SECRET'),
|
||||
|
||||
Reference in New Issue
Block a user