mirror of
https://github.com/NyaaStudios/nyaabooru.git
synced 2025-12-09 21:42:57 +00:00
41 lines
981 B
PHP
41 lines
981 B
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use App\Models\PersonalAccessToken;
|
|
use Illuminate\Support\Facades\Event;
|
|
use Illuminate\Support\Facades\Gate;
|
|
use Illuminate\Support\ServiceProvider;
|
|
use Laravel\Sanctum\Sanctum;
|
|
use SocialiteProviders\Authentik\Provider as AuthentikProvider;
|
|
use SocialiteProviders\Manager\SocialiteWasCalled;
|
|
|
|
class AppServiceProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* Register any application services.
|
|
*/
|
|
public function register(): void
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Bootstrap any application services.
|
|
*/
|
|
public function boot(): void
|
|
{
|
|
// Setup admin role access
|
|
Gate::before(function ($user, $ability)
|
|
{
|
|
return $user->hasRole('admin') ? true : null;
|
|
});
|
|
|
|
Sanctum::usePersonalAccessTokenModel(PersonalAccessToken::class);
|
|
|
|
// Authentik
|
|
Event::listen(function (SocialiteWasCalled $event) {
|
|
$event->extendSocialite('authentik', AuthentikProvider::class);
|
|
});
|
|
}
|
|
}
|