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
@@ -6,6 +6,7 @@ use Illuminate\Http\Request;
use Pterodactyl\Models\Node;
use Pterodactyl\Models\ApiKey;
use Illuminate\Http\JsonResponse;
use Pterodactyl\Services\Acl\Api\AdminAcl;
use Pterodactyl\Http\Controllers\Controller;
use Illuminate\Contracts\Encryption\Encrypter;
use Pterodactyl\Services\Api\KeyCreationService;
@@ -23,7 +24,7 @@ class NodeAutoDeployController extends Controller
/**
* Generates a new API key for the logged-in user with only permission to read
* nodes, and returns that as the deployment key for a node.
* node configurations, and returns that as the deployment key for a node.
*
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
*/
@@ -31,18 +32,20 @@ class NodeAutoDeployController extends Controller
{
$key = ApiKey::query()
->where('user_id', $request->user()->id)
->where('node_id', $node->id)
->where('key_type', ApiKey::TYPE_APPLICATION)
->where('r_nodes', 1)
->where('r_nodes', AdminAcl::READ_CONFIGURATION)
->first();
// We couldn't find a key that exists for this user with only permission for
// reading nodes. Go ahead and create it now.
// reading node configurations. Go ahead and create it now.
if (!$key) {
$key = $this->keyCreationService->setKeyType(ApiKey::TYPE_APPLICATION)->handle([
'user_id' => $request->user()->id,
'node_id' => $node->id,
'memo' => 'Automatically generated node deployment key.',
'allowed_ips' => [],
], ['r_nodes' => 1]);
], ['r_nodes' => AdminAcl::READ_CONFIGURATION]);
}
return new JsonResponse([