Files

31 lines
760 B
PHP
Raw Permalink Normal View History

<?php
2026-10-05 18:10:18 -04:00
declare(strict_types=1);
namespace Pterodactyl\Http\Requests\Api\Client;
use Pterodactyl\Contracts\Http\ClientPermissionsRequest;
use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest;
2026-10-05 18:10:18 -04:00
use Pterodactyl\Models\Server;
use Pterodactyl\Models\User;
2019-07-27 15:17:50 -07:00
/**
2026-10-05 18:10:18 -04:00
* @method User user($guard = null)
2019-07-27 15:17:50 -07:00
*/
2020-03-18 21:08:32 -07:00
class ClientApiRequest extends ApplicationApiRequest
{
/**
* Determine if the current user is authorized to perform the requested action against the API.
*/
public function authorize(): bool
{
2026-10-05 18:10:18 -04:00
if ($this instanceof ClientPermissionsRequest) {
$server = $this->parameter('server', Server::class);
2026-10-05 18:10:18 -04:00
return $this->user()->can($this->permission(), $server);
}
return true;
}
}