2026-10-05 18:10:18 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace Pterodactyl\Http\Requests\Api\Application\Nodes;
|
|
|
|
|
|
2026-10-12 15:27:35 +05:45
|
|
|
use Pterodactyl\Models\ApiKey;
|
2026-10-05 18:10:18 -04:00
|
|
|
use Pterodactyl\Services\Acl\Api\AdminAcl;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Reading a node's configuration returns its daemon token, so it needs write access to nodes.
|
|
|
|
|
*/
|
|
|
|
|
class GetNodeConfigurationRequest extends GetNodesRequest
|
|
|
|
|
{
|
|
|
|
|
protected int $permission = AdminAcl::WRITE;
|
2026-10-12 15:27:35 +05:45
|
|
|
|
|
|
|
|
public function authorize(): bool
|
|
|
|
|
{
|
|
|
|
|
$token = $this->user()?->currentAccessToken();
|
|
|
|
|
|
2026-10-12 07:47:42 -04:00
|
|
|
return (! $token instanceof ApiKey || $token->key_type !== ApiKey::TYPE_ACCOUNT) && parent::authorize();
|
2026-10-12 15:27:35 +05:45
|
|
|
}
|
2026-10-05 18:10:18 -04:00
|
|
|
}
|