mirror of
https://github.com/pterodactyl/panel.git
synced 2026-12-02 12:25:44 -05:00
27 lines
700 B
PHP
27 lines
700 B
PHP
<?php
|
|
|
|
namespace Pterodactyl\Http\Requests\Api\Application\Nodes;
|
|
|
|
use Pterodactyl\Models\Node;
|
|
use Pterodactyl\Models\ApiKey;
|
|
use Pterodactyl\Services\Acl\Api\AdminAcl;
|
|
|
|
class GetNodeConfigurationRequest extends GetNodesRequest
|
|
{
|
|
protected int $permission = AdminAcl::WRITE;
|
|
|
|
public function authorize(): bool
|
|
{
|
|
$token = $this->user()->currentAccessToken();
|
|
if ($token instanceof ApiKey && AdminAcl::check($token, $this->resource, AdminAcl::READ_CONFIGURATION)) {
|
|
$node = $this->parameter('node', Node::class);
|
|
|
|
if ($token->node_id === $node->id) {
|
|
return true;
|
|
}
|
|
}
|
|
|
|
return parent::authorize();
|
|
}
|
|
}
|