mirror of
https://github.com/pterodactyl/panel.git
synced 2026-11-30 11:25:52 -05:00
Co-authored-by: Anthony <anthony@infraly.co> Co-authored-by: Sky Mulley <daniel.mulley@outlook.com>
33 lines
786 B
PHP
33 lines
786 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Pterodactyl\Http\Middleware\Activity;
|
|
|
|
use Closure;
|
|
use Illuminate\Http\Request;
|
|
use Pterodactyl\Facades\LogTarget;
|
|
use Pterodactyl\Http\Concerns\ResolvesRequestContext;
|
|
use Symfony\Component\HttpFoundation\Response;
|
|
|
|
class AccountSubject
|
|
{
|
|
use ResolvesRequestContext;
|
|
|
|
/**
|
|
* Sets the actor and default subject for all requests passing through this
|
|
* middleware to be the currently logged in user.
|
|
*
|
|
* @param Closure(Request):Response $next
|
|
* @return Response
|
|
*/
|
|
public function handle(Request $request, Closure $next): mixed
|
|
{
|
|
$user = $this->authenticatedUser($request);
|
|
LogTarget::setActor($user);
|
|
LogTarget::setSubject($user);
|
|
|
|
return $next($request);
|
|
}
|
|
}
|