Fix bad permissions check on server API route
This commit is contained in:
parent
807521b97c
commit
baeffef24b
4 changed files with 24 additions and 16 deletions
|
@ -8,6 +8,7 @@ This project follows [Semantic Versioning](http://semver.org) guidelines.
|
||||||
* Fixes an exception thrown when trying to access the `/nests/:id/eggs/:id` API endpoint.
|
* Fixes an exception thrown when trying to access the `/nests/:id/eggs/:id` API endpoint.
|
||||||
* Fixes search on server listing page.
|
* Fixes search on server listing page.
|
||||||
* Schedules with no names are now clickable to allow editing.
|
* Schedules with no names are now clickable to allow editing.
|
||||||
|
* Fixes broken permissions check that would deny access to API keys that did in fact have permission.
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
* Adds ability to include egg variables on an API request.
|
* Adds ability to include egg variables on an API request.
|
||||||
|
|
|
@ -9,6 +9,7 @@ use Pterodactyl\Services\Servers\ServerCreationService;
|
||||||
use Pterodactyl\Services\Servers\ServerDeletionService;
|
use Pterodactyl\Services\Servers\ServerDeletionService;
|
||||||
use Pterodactyl\Contracts\Repository\ServerRepositoryInterface;
|
use Pterodactyl\Contracts\Repository\ServerRepositoryInterface;
|
||||||
use Pterodactyl\Transformers\Api\Application\ServerTransformer;
|
use Pterodactyl\Transformers\Api\Application\ServerTransformer;
|
||||||
|
use Pterodactyl\Http\Requests\Api\Application\Servers\GetServerRequest;
|
||||||
use Pterodactyl\Http\Requests\Api\Application\Servers\GetServersRequest;
|
use Pterodactyl\Http\Requests\Api\Application\Servers\GetServersRequest;
|
||||||
use Pterodactyl\Http\Requests\Api\Application\Servers\ServerWriteRequest;
|
use Pterodactyl\Http\Requests\Api\Application\Servers\ServerWriteRequest;
|
||||||
use Pterodactyl\Http\Requests\Api\Application\Servers\StoreServerRequest;
|
use Pterodactyl\Http\Requests\Api\Application\Servers\StoreServerRequest;
|
||||||
|
@ -91,10 +92,10 @@ class ServerController extends ApplicationApiController
|
||||||
/**
|
/**
|
||||||
* Show a single server transformed for the application API.
|
* Show a single server transformed for the application API.
|
||||||
*
|
*
|
||||||
* @param \Pterodactyl\Http\Requests\Api\Application\Servers\ServerWriteRequest $request
|
* @param \Pterodactyl\Http\Requests\Api\Application\Servers\GetServerRequest $request
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function view(ServerWriteRequest $request): array
|
public function view(GetServerRequest $request): array
|
||||||
{
|
{
|
||||||
return $this->fractal->item($request->getModel(Server::class))
|
return $this->fractal->item($request->getModel(Server::class))
|
||||||
->transformWith($this->getTransformer(ServerTransformer::class))
|
->transformWith($this->getTransformer(ServerTransformer::class))
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Pterodactyl\Http\Requests\Api\Application\Servers;
|
||||||
|
|
||||||
|
use Pterodactyl\Services\Acl\Api\AdminAcl;
|
||||||
|
use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest;
|
||||||
|
|
||||||
|
class GetServerRequest extends ApplicationApiRequest
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $resource = AdminAcl::RESOURCE_SERVERS;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
protected $permission = AdminAcl::READ;
|
||||||
|
}
|
|
@ -2,21 +2,8 @@
|
||||||
|
|
||||||
namespace Pterodactyl\Http\Requests\Api\Application\Servers;
|
namespace Pterodactyl\Http\Requests\Api\Application\Servers;
|
||||||
|
|
||||||
use Pterodactyl\Services\Acl\Api\AdminAcl;
|
class GetServersRequest extends GetServerRequest
|
||||||
use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest;
|
|
||||||
|
|
||||||
class GetServersRequest extends ApplicationApiRequest
|
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
protected $resource = AdminAcl::RESOURCE_SERVERS;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var int
|
|
||||||
*/
|
|
||||||
protected $permission = AdminAcl::READ;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue