misc_pterodactyl-panel/app/Http/Middleware/AdminAuthenticate.php

24 lines
554 B
PHP
Raw Normal View History

<?php
2016-12-07 22:46:38 +00:00
namespace Pterodactyl\Http\Middleware;
2017-10-29 17:37:25 +00:00
use Illuminate\Http\Request;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
class AdminAuthenticate
{
/**
* Handle an incoming request.
*
* @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException
*/
2022-11-29 17:53:59 +00:00
public function handle(Request $request, \Closure $next): mixed
{
2021-01-23 20:33:34 +00:00
if (!$request->user() || !$request->user()->root_admin) {
throw new AccessDeniedHttpException();
}
return $next($request);
}
}