Path: blob/1.0-develop/app/Http/Middleware/Activity/ServerSubject.php
10279 views
<?php12namespace Pterodactyl\Http\Middleware\Activity;34use Illuminate\Http\Request;5use Pterodactyl\Models\Server;6use Pterodactyl\Facades\LogTarget;78class ServerSubject9{10/**11* Attempts to automatically scope all of the activity log events registered12* within the request instance to the given user and server. This only sets13* the actor and subject if there is a server present on the request.14*15* If no server is found this is a no-op as the activity log service can always16* set the user based on the authmanager response.17*/18public function handle(Request $request, \Closure $next)19{20$server = $request->route()->parameter('server');21if ($server instanceof Server) {22LogTarget::setActor($request->user());23LogTarget::setSubject($server);24}2526return $next($request);27}28}293031