Path: blob/1.0-develop/app/Http/Requests/Api/Client/ClientApiRequest.php
10266 views
<?php12namespace Pterodactyl\Http\Requests\Api\Client;34use Pterodactyl\Models\Server;5use Pterodactyl\Contracts\Http\ClientPermissionsRequest;6use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest;78/**9* @method \Pterodactyl\Models\User user($guard = null)10*/11class ClientApiRequest extends ApplicationApiRequest12{13/**14* Determine if the current user is authorized to perform the requested action against the API.15*/16public function authorize(): bool17{18if ($this instanceof ClientPermissionsRequest || method_exists($this, 'permission')) {19$server = $this->route()->parameter('server');2021if ($server instanceof Server) {22return $this->user()->can($this->permission(), $server);23}2425// If there is no server available on the reqest, trigger a failure since26// we expect there to be one at this point.27return false;28}2930return true;31}32}333435