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>
31 lines
760 B
PHP
31 lines
760 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Pterodactyl\Http\Requests\Api\Client;
|
|
|
|
use Pterodactyl\Contracts\Http\ClientPermissionsRequest;
|
|
use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest;
|
|
use Pterodactyl\Models\Server;
|
|
use Pterodactyl\Models\User;
|
|
|
|
/**
|
|
* @method User user($guard = null)
|
|
*/
|
|
class ClientApiRequest extends ApplicationApiRequest
|
|
{
|
|
/**
|
|
* Determine if the current user is authorized to perform the requested action against the API.
|
|
*/
|
|
public function authorize(): bool
|
|
{
|
|
if ($this instanceof ClientPermissionsRequest) {
|
|
$server = $this->parameter('server', Server::class);
|
|
|
|
return $this->user()->can($this->permission(), $server);
|
|
}
|
|
|
|
return true;
|
|
}
|
|
}
|