Update existing application API to use simplified user permission checking

This commit is contained in:
Dane Everitt 2021-08-04 21:14:14 -07:00
parent 622d292f39
commit 47b895a98a
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
57 changed files with 109 additions and 532 deletions

View file

@ -2,6 +2,7 @@
namespace Pterodactyl\Http\Controllers\Api\Application\Servers;
use Pterodactyl\Models\Server;
use Pterodactyl\Transformers\Api\Application\ServerTransformer;
use Pterodactyl\Http\Controllers\Api\Application\ApplicationApiController;
use Pterodactyl\Http\Requests\Api\Application\Servers\GetExternalServerRequest;
@ -13,9 +14,11 @@ class ExternalServerController extends ApplicationApiController
*
* @throws \Illuminate\Contracts\Container\BindingResolutionException
*/
public function index(GetExternalServerRequest $request): array
public function index(GetExternalServerRequest $request, string $external_id): array
{
return $this->fractal->item($request->getServerModel())
$server = Server::query()->where('external_id', $external_id)->firstOrFail();
return $this->fractal->item($server)
->transformWith($this->getTransformer(ServerTransformer::class))
->toArray();
}