scope node configure flow

This commit is contained in:
robert dennis
2026-06-23 17:05:03 -04:00
parent 24458ea087
commit 809122d682
9 changed files with 165 additions and 6 deletions
@@ -0,0 +1,31 @@
<?php
namespace Pterodactyl\Tests\Integration\Http\Controllers\Admin;
use Pterodactyl\Models\Node;
use Pterodactyl\Models\User;
use Pterodactyl\Models\ApiKey;
use Pterodactyl\Models\Location;
use Pterodactyl\Services\Acl\Api\AdminAcl;
use Pterodactyl\Tests\Integration\Http\HttpTestCase;
class NodeAutoDeployControllerTest extends HttpTestCase
{
public function testGeneratedTokenIsScopedToNodeConfiguration(): void
{
$node = Node::factory()->for(Location::factory())->create();
$response = $this->actingAs(User::factory()->admin()->create())
->postJson(route('admin.nodes.view.configuration.token', ['node' => $node]));
$response->assertOk();
$response->assertJsonPath('node', $node->id);
$key = ApiKey::query()
->where('identifier', substr($response->json('token'), 0, ApiKey::IDENTIFIER_LENGTH))
->firstOrFail();
$this->assertSame($node->id, $key->node_id);
$this->assertSame(AdminAcl::READ_CONFIGURATION, $key->r_nodes);
}
}