From 048784607db45ecb32faa6e10922b43fe4c4621d Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sat, 30 Sep 2017 11:45:24 -0500 Subject: [PATCH] Minor bug fixes --- app/Http/Middleware/Server/SubuserAccess.php | 2 +- app/Jobs/Schedule/RunTaskJob.php | 7 +++++-- app/Repositories/Daemon/ServerRepository.php | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/Http/Middleware/Server/SubuserAccess.php b/app/Http/Middleware/Server/SubuserAccess.php index ec66ea8f5..85ebe2640 100644 --- a/app/Http/Middleware/Server/SubuserAccess.php +++ b/app/Http/Middleware/Server/SubuserAccess.php @@ -40,7 +40,7 @@ class SubuserAccess } /** - * Determine if a user has permission to access a subuser. + * Determine if a user has permission to access and modify subuser. * * @param \Illuminate\Http\Request $request * @param \Closure $next diff --git a/app/Jobs/Schedule/RunTaskJob.php b/app/Jobs/Schedule/RunTaskJob.php index 2f8eb80dd..7bedf6c7a 100644 --- a/app/Jobs/Schedule/RunTaskJob.php +++ b/app/Jobs/Schedule/RunTaskJob.php @@ -19,6 +19,7 @@ use Illuminate\Queue\InteractsWithQueue; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Foundation\Bus\DispatchesJobs; use Pterodactyl\Contracts\Repository\TaskRepositoryInterface; +use Pterodactyl\Services\DaemonKeys\DaemonKeyProviderService; use Pterodactyl\Contracts\Repository\ScheduleRepositoryInterface; use Pterodactyl\Contracts\Repository\Daemon\PowerRepositoryInterface; use Pterodactyl\Contracts\Repository\Daemon\CommandRepositoryInterface; @@ -71,6 +72,7 @@ class RunTaskJob extends Job implements ShouldQueue * Run the job and send actions to the daemon running the server. * * @param \Pterodactyl\Contracts\Repository\Daemon\CommandRepositoryInterface $commandRepository + * @param \Pterodactyl\Services\DaemonKeys\DaemonKeyProviderService $keyProviderService * @param \Pterodactyl\Contracts\Repository\Daemon\PowerRepositoryInterface $powerRepository * @param \Pterodactyl\Contracts\Repository\TaskRepositoryInterface $taskRepository * @@ -80,6 +82,7 @@ class RunTaskJob extends Job implements ShouldQueue */ public function handle( CommandRepositoryInterface $commandRepository, + DaemonKeyProviderService $keyProviderService, PowerRepositoryInterface $powerRepository, TaskRepositoryInterface $taskRepository ) { @@ -95,13 +98,13 @@ class RunTaskJob extends Job implements ShouldQueue case 'power': $this->powerRepository->setNode($server->node_id) ->setAccessServer($server->uuid) - ->setAccessToken($server->accessToken->secret) + ->setAccessToken($keyProviderService->handle($server->id, $server->owner_id)) ->sendSignal($task->payload); break; case 'command': $this->commandRepository->setNode($server->node_id) ->setAccessServer($server->uuid) - ->setAccessToken($server->accessToken->secret) + ->setAccessToken($keyProviderService->handle($server->id, $server->owner_id)) ->send($task->payload); break; default: diff --git a/app/Repositories/Daemon/ServerRepository.php b/app/Repositories/Daemon/ServerRepository.php index 583be47ba..0980a467a 100644 --- a/app/Repositories/Daemon/ServerRepository.php +++ b/app/Repositories/Daemon/ServerRepository.php @@ -131,7 +131,7 @@ class ServerRepository extends BaseRepository implements ServerRepositoryInterfa */ public function details() { - return $this->getHttpClient()->request('GET', '/servers'); + return $this->getHttpClient()->request('GET', '/server'); } /**