Reorganize API files
This commit is contained in:
parent
bdadec002c
commit
0e7f8cedf0
41 changed files with 156 additions and 111 deletions
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Pterodactyl\Http\Controllers\API\Remote;
|
||||
namespace Pterodactyl\Http\Controllers\Api\Remote;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
namespace Pterodactyl\Http\Controllers\API\Remote;
|
||||
namespace Pterodactyl\Http\Controllers\Api\Remote;
|
||||
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Pterodactyl\Http\Controllers\Controller;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Pterodactyl\Http\Controllers\API\Remote;
|
||||
namespace Pterodactyl\Http\Controllers\Api\Remote;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
namespace Pterodactyl\Http\Controllers\API\Remote;
|
||||
namespace Pterodactyl\Http\Controllers\Api\Remote;
|
||||
|
||||
use Spatie\Fractal\Fractal;
|
||||
use Pterodactyl\Http\Controllers\Controller;
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
<?php
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Pterodactyl\Http\Controllers\API\Admin\Locations;
|
||||
namespace Pterodactyl\Http\Controllers\Api\Application\Locations;
|
||||
|
||||
use Spatie\Fractal\Fractal;
|
||||
use Illuminate\Http\Response;
|
||||
|
@ -13,9 +13,9 @@ use Pterodactyl\Services\Locations\LocationCreationService;
|
|||
use Pterodactyl\Services\Locations\LocationDeletionService;
|
||||
use Pterodactyl\Transformers\Api\Admin\LocationTransformer;
|
||||
use Pterodactyl\Contracts\Repository\LocationRepositoryInterface;
|
||||
use Pterodactyl\Http\Requests\API\Admin\Locations\GetLocationsRequest;
|
||||
use Pterodactyl\Http\Requests\API\Admin\Locations\DeleteLocationRequest;
|
||||
use Pterodactyl\Http\Requests\API\Admin\Locations\UpdateLocationRequest;
|
||||
use Pterodactyl\Http\Requests\Api\Application\Locations\GetLocationsRequest;
|
||||
use Pterodactyl\Http\Requests\Api\Application\Locations\DeleteLocationRequest;
|
||||
use Pterodactyl\Http\Requests\Api\Application\Locations\UpdateLocationRequest;
|
||||
|
||||
class LocationController extends Controller
|
||||
{
|
||||
|
@ -70,7 +70,7 @@ class LocationController extends Controller
|
|||
/**
|
||||
* Return all of the locations currently registered on the Panel.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\API\Admin\Locations\GetLocationsRequest $request
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Locations\GetLocationsRequest $request
|
||||
* @return array
|
||||
*/
|
||||
public function index(GetLocationsRequest $request): array
|
||||
|
@ -87,8 +87,8 @@ class LocationController extends Controller
|
|||
/**
|
||||
* Return a single location.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Controllers\API\Admin\Locations\GetLocationRequest $request
|
||||
* @param \Pterodactyl\Models\Location $location
|
||||
* @param \Pterodactyl\Http\Controllers\Api\Application\Locations\GetLocationRequest $request
|
||||
* @param \Pterodactyl\Models\Location $location
|
||||
* @return array
|
||||
*/
|
||||
public function view(GetLocationRequest $request, Location $location): array
|
||||
|
@ -103,7 +103,7 @@ class LocationController extends Controller
|
|||
* Store a new location on the Panel and return a HTTP/201 response code with the
|
||||
* new location attached.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Controllers\API\Admin\Locations\StoreLocationRequest $request
|
||||
* @param \Pterodactyl\Http\Controllers\Api\Application\Locations\StoreLocationRequest $request
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
|
@ -121,8 +121,8 @@ class LocationController extends Controller
|
|||
/**
|
||||
* Update a location on the Panel and return the updated record to the user.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\API\Admin\Locations\UpdateLocationRequest $request
|
||||
* @param \Pterodactyl\Models\Location $location
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Locations\UpdateLocationRequest $request
|
||||
* @param \Pterodactyl\Models\Location $location
|
||||
* @return array
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
|
@ -141,8 +141,8 @@ class LocationController extends Controller
|
|||
/**
|
||||
* Delete a location from the Panel.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\API\Admin\Locations\DeleteLocationRequest $request
|
||||
* @param \Pterodactyl\Models\Location $location
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Locations\DeleteLocationRequest $request
|
||||
* @param \Pterodactyl\Models\Location $location
|
||||
* @return \Illuminate\Http\Response
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Service\Location\HasActiveNodesException
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Pterodactyl\Http\Controllers\API\Admin\Nodes;
|
||||
namespace Pterodactyl\Http\Controllers\Api\Application\Nodes;
|
||||
|
||||
use Spatie\Fractal\Fractal;
|
||||
use Pterodactyl\Models\Node;
|
||||
|
@ -11,8 +11,8 @@ use League\Fractal\Pagination\IlluminatePaginatorAdapter;
|
|||
use Pterodactyl\Transformers\Api\Admin\AllocationTransformer;
|
||||
use Pterodactyl\Services\Allocations\AllocationDeletionService;
|
||||
use Pterodactyl\Contracts\Repository\AllocationRepositoryInterface;
|
||||
use Pterodactyl\Http\Requests\API\Admin\Allocations\GetAllocationsRequest;
|
||||
use Pterodactyl\Http\Requests\API\Admin\Allocations\DeleteAllocationRequest;
|
||||
use Pterodactyl\Http\Requests\Api\Application\Allocations\GetAllocationsRequest;
|
||||
use Pterodactyl\Http\Requests\Api\Application\Allocations\DeleteAllocationRequest;
|
||||
|
||||
class AllocationController extends Controller
|
||||
{
|
||||
|
@ -48,8 +48,8 @@ class AllocationController extends Controller
|
|||
/**
|
||||
* Return all of the allocations that exist for a given node.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\API\Admin\Allocations\GetAllocationsRequest $request
|
||||
* @param \Pterodactyl\Models\Node $node
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Allocations\GetAllocationsRequest $request
|
||||
* @param \Pterodactyl\Models\Node $node
|
||||
* @return array
|
||||
*/
|
||||
public function index(GetAllocationsRequest $request, Node $node): array
|
||||
|
@ -66,9 +66,9 @@ class AllocationController extends Controller
|
|||
/**
|
||||
* Delete a specific allocation from the Panel.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\API\Admin\Allocations\DeleteAllocationRequest $request
|
||||
* @param \Pterodactyl\Models\Node $node
|
||||
* @param \Pterodactyl\Models\Allocation $allocation
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Allocations\DeleteAllocationRequest $request
|
||||
* @param \Pterodactyl\Models\Node $node
|
||||
* @param \Pterodactyl\Models\Allocation $allocation
|
||||
* @return \Illuminate\Http\Response
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Service\Allocation\ServerUsingAllocationException
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Pterodactyl\Http\Controllers\API\Admin\Nodes;
|
||||
namespace Pterodactyl\Http\Controllers\Api\Application\Nodes;
|
||||
|
||||
use Spatie\Fractal\Fractal;
|
||||
use Pterodactyl\Models\Node;
|
||||
|
@ -13,11 +13,11 @@ use Pterodactyl\Services\Nodes\NodeDeletionService;
|
|||
use Pterodactyl\Transformers\Api\Admin\NodeTransformer;
|
||||
use League\Fractal\Pagination\IlluminatePaginatorAdapter;
|
||||
use Pterodactyl\Contracts\Repository\NodeRepositoryInterface;
|
||||
use Pterodactyl\Http\Requests\API\Admin\Nodes\GetNodeRequest;
|
||||
use Pterodactyl\Http\Requests\API\Admin\Nodes\GetNodesRequest;
|
||||
use Pterodactyl\Http\Requests\API\Admin\Nodes\StoreNodeRequest;
|
||||
use Pterodactyl\Http\Requests\API\Admin\Nodes\DeleteNodeRequest;
|
||||
use Pterodactyl\Http\Requests\API\Admin\Nodes\UpdateNodeRequest;
|
||||
use Pterodactyl\Http\Requests\Api\Application\Nodes\GetNodeRequest;
|
||||
use Pterodactyl\Http\Requests\Api\Application\Nodes\GetNodesRequest;
|
||||
use Pterodactyl\Http\Requests\Api\Application\Nodes\StoreNodeRequest;
|
||||
use Pterodactyl\Http\Requests\Api\Application\Nodes\DeleteNodeRequest;
|
||||
use Pterodactyl\Http\Requests\Api\Application\Nodes\UpdateNodeRequest;
|
||||
|
||||
class NodeController extends Controller
|
||||
{
|
||||
|
@ -72,7 +72,7 @@ class NodeController extends Controller
|
|||
/**
|
||||
* Return all of the nodes currently available on the Panel.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\API\Admin\Nodes\GetNodesRequest $request
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Nodes\GetNodesRequest $request
|
||||
* @return array
|
||||
*/
|
||||
public function index(GetNodesRequest $request): array
|
||||
|
@ -89,8 +89,8 @@ class NodeController extends Controller
|
|||
/**
|
||||
* Return data for a single instance of a node.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\API\Admin\Nodes\GetNodeRequest $request
|
||||
* @param \Pterodactyl\Models\Node $node
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Nodes\GetNodeRequest $request
|
||||
* @param \Pterodactyl\Models\Node $node
|
||||
* @return array
|
||||
*/
|
||||
public function view(GetNodeRequest $request, Node $node): array
|
||||
|
@ -105,7 +105,7 @@ class NodeController extends Controller
|
|||
* Create a new node on the Panel. Returns the created node and a HTTP/201
|
||||
* status response on success.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\API\Admin\Nodes\StoreNodeRequest $request
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Nodes\StoreNodeRequest $request
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
|
@ -126,8 +126,8 @@ class NodeController extends Controller
|
|||
/**
|
||||
* Update an existing node on the Panel.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\API\Admin\Nodes\UpdateNodeRequest $request
|
||||
* @param \Pterodactyl\Models\Node $node
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Nodes\UpdateNodeRequest $request
|
||||
* @param \Pterodactyl\Models\Node $node
|
||||
* @return array
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
|
@ -148,8 +148,8 @@ class NodeController extends Controller
|
|||
* Deletes a given node from the Panel as long as there are no servers
|
||||
* currently attached to it.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\API\Admin\Nodes\DeleteNodeRequest $request
|
||||
* @param \Pterodactyl\Models\Node $node
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Nodes\DeleteNodeRequest $request
|
||||
* @param \Pterodactyl\Models\Node $node
|
||||
* @return \Illuminate\Http\Response
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Service\HasActiveServersException
|
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
|
||||
namespace Pterodactyl\Http\Controllers\Api\Admin;
|
||||
|
||||
use Spatie\Fractal\Fractal;
|
||||
use Illuminate\Http\Request;
|
||||
use Pterodactyl\Http\Controllers\Controller;
|
||||
use Pterodactyl\Transformers\Api\Admin\ServerTransformer;
|
||||
use Pterodactyl\Contracts\Repository\ServerRepositoryInterface;
|
||||
|
||||
class ServerController extends Controller
|
||||
{
|
||||
/**
|
||||
* @var \Spatie\Fractal\Fractal
|
||||
*/
|
||||
private $fractal;
|
||||
|
||||
/**
|
||||
* @var \Pterodactyl\Contracts\Repository\ServerRepositoryInterface
|
||||
*/
|
||||
private $repository;
|
||||
|
||||
/**
|
||||
* ServerController constructor.
|
||||
*
|
||||
* @param \Spatie\Fractal\Fractal $fractal
|
||||
* @param \Pterodactyl\Contracts\Repository\ServerRepositoryInterface $repository
|
||||
*/
|
||||
public function __construct(Fractal $fractal, ServerRepositoryInterface $repository)
|
||||
{
|
||||
$this->fractal = $fractal;
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
public function index(Request $request): array
|
||||
{
|
||||
$servers = $this->repository->paginated(50);
|
||||
|
||||
return $this->fractal->collection($servers)
|
||||
->transformWith((new ServerTransformer)->setKey())
|
||||
->withResourceName('server')
|
||||
->toArray();
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Pterodactyl\Http\Controllers\API\Admin\Users;
|
||||
namespace Pterodactyl\Http\Controllers\Api\Application\Users;
|
||||
|
||||
use Spatie\Fractal\Fractal;
|
||||
use Illuminate\Http\Request;
|
||||
|
@ -14,11 +14,11 @@ use Pterodactyl\Services\Users\UserDeletionService;
|
|||
use Pterodactyl\Transformers\Api\Admin\UserTransformer;
|
||||
use League\Fractal\Pagination\IlluminatePaginatorAdapter;
|
||||
use Pterodactyl\Contracts\Repository\UserRepositoryInterface;
|
||||
use Pterodactyl\Http\Requests\API\Admin\Users\GetUserRequest;
|
||||
use Pterodactyl\Http\Requests\API\Admin\Users\GetUsersRequest;
|
||||
use Pterodactyl\Http\Requests\API\Admin\Users\StoreUserRequest;
|
||||
use Pterodactyl\Http\Requests\API\Admin\Users\DeleteUserRequest;
|
||||
use Pterodactyl\Http\Requests\API\Admin\Users\UpdateUserRequest;
|
||||
use Pterodactyl\Http\Requests\Api\Application\Users\GetUserRequest;
|
||||
use Pterodactyl\Http\Requests\Api\Application\Users\GetUsersRequest;
|
||||
use Pterodactyl\Http\Requests\Api\Application\Users\StoreUserRequest;
|
||||
use Pterodactyl\Http\Requests\Api\Application\Users\DeleteUserRequest;
|
||||
use Pterodactyl\Http\Requests\Api\Application\Users\UpdateUserRequest;
|
||||
|
||||
class UserController extends Controller
|
||||
{
|
||||
|
@ -75,7 +75,7 @@ class UserController extends Controller
|
|||
* of a collection of users including any defined relations passed in
|
||||
* the request.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\API\Admin\Users\GetUsersRequest $request
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Users\GetUsersRequest $request
|
||||
* @return array
|
||||
*/
|
||||
public function index(GetUsersRequest $request): array
|
||||
|
@ -93,8 +93,8 @@ class UserController extends Controller
|
|||
* Handle a request to view a single user. Includes any relations that
|
||||
* were defined in the request.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\API\Admin\Users\GetUserRequest $request
|
||||
* @param \Pterodactyl\Models\User $user
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Users\GetUserRequest $request
|
||||
* @param \Pterodactyl\Models\User $user
|
||||
* @return array
|
||||
*/
|
||||
public function view(GetUserRequest $request, User $user): array
|
||||
|
@ -113,8 +113,8 @@ class UserController extends Controller
|
|||
* Revocation errors are returned under the 'revocation_errors' key in the response
|
||||
* meta. If there are no errors this is an empty array.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\API\Admin\Users\UpdateUserRequest $request
|
||||
* @param \Pterodactyl\Models\User $user
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Users\UpdateUserRequest $request
|
||||
* @param \Pterodactyl\Models\User $user
|
||||
* @return array
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
|
@ -156,7 +156,7 @@ class UserController extends Controller
|
|||
* Store a new user on the system. Returns the created user and a HTTP/201
|
||||
* header on successful creation.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\API\Admin\Users\StoreUserRequest $request
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Users\StoreUserRequest $request
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*
|
||||
* @throws \Exception
|
||||
|
@ -179,8 +179,8 @@ class UserController extends Controller
|
|||
* Handle a request to delete a user from the Panel. Returns a HTTP/204 response
|
||||
* on successful deletion.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\API\Admin\Users\DeleteUserRequest $request
|
||||
* @param \Pterodactyl\Models\User $user
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Users\DeleteUserRequest $request
|
||||
* @param \Pterodactyl\Models\User $user
|
||||
* @return \Illuminate\Http\Response
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
|
@ -19,20 +19,20 @@ use Pterodactyl\Http\Middleware\AccessingValidServer;
|
|||
use Illuminate\View\Middleware\ShareErrorsFromSession;
|
||||
use Pterodactyl\Http\Middleware\RedirectIfAuthenticated;
|
||||
use Illuminate\Auth\Middleware\AuthenticateWithBasicAuth;
|
||||
use Pterodactyl\Http\Middleware\Api\Admin\AuthenticateKey;
|
||||
use Illuminate\Foundation\Http\Middleware\ValidatePostSize;
|
||||
use Pterodactyl\Http\Middleware\Api\Admin\AuthenticateUser;
|
||||
use Pterodactyl\Http\Middleware\Api\Admin\SetSessionDriver;
|
||||
use Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse;
|
||||
use Pterodactyl\Http\Middleware\Server\AuthenticateAsSubuser;
|
||||
use Pterodactyl\Http\Middleware\Api\Daemon\DaemonAuthenticate;
|
||||
use Pterodactyl\Http\Middleware\Server\SubuserBelongsToServer;
|
||||
use Pterodactyl\Http\Middleware\Api\Admin\AuthenticateIPAccess;
|
||||
use Pterodactyl\Http\Middleware\RequireTwoFactorAuthentication;
|
||||
use Pterodactyl\Http\Middleware\Server\DatabaseBelongsToServer;
|
||||
use Pterodactyl\Http\Middleware\Server\ScheduleBelongsToServer;
|
||||
use Pterodactyl\Http\Middleware\Api\Application\AuthenticateKey;
|
||||
use Pterodactyl\Http\Middleware\Api\Application\AuthenticateUser;
|
||||
use Pterodactyl\Http\Middleware\Api\Application\SetSessionDriver;
|
||||
use Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode;
|
||||
use Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull;
|
||||
use Pterodactyl\Http\Middleware\Api\Application\AuthenticateIPAccess;
|
||||
use Pterodactyl\Http\Middleware\DaemonAuthenticate as OldDaemonAuthenticate;
|
||||
|
||||
class Kernel extends HttpKernel
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Pterodactyl\Http\Middleware\Api\Admin;
|
||||
namespace Pterodactyl\Http\Middleware\Api\Application;
|
||||
|
||||
use Closure;
|
||||
use IPTools\IP;
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Pterodactyl\Http\Middleware\Api\Admin;
|
||||
namespace Pterodactyl\Http\Middleware\Api\Application;
|
||||
|
||||
use Closure;
|
||||
use Cake\Chronos\Chronos;
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Pterodactyl\Http\Middleware\Api\Admin;
|
||||
namespace Pterodactyl\Http\Middleware\Api\Application;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Pterodactyl\Http\Middleware\Api\Admin;
|
||||
namespace Pterodactyl\Http\Middleware\Api\Application;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace Pterodactyl\Http\Requests\API\Admin\Allocations;
|
||||
namespace Pterodactyl\Http\Requests\Api\Application\Allocations;
|
||||
|
||||
use Pterodactyl\Models\Node;
|
||||
use Pterodactyl\Models\Allocation;
|
||||
use Pterodactyl\Services\Acl\Api\AdminAcl;
|
||||
use Pterodactyl\Http\Requests\API\Admin\ApiAdminRequest;
|
||||
use Pterodactyl\Http\Requests\Api\Application\ApiAdminRequest;
|
||||
|
||||
class DeleteAllocationRequest extends ApiAdminRequest
|
||||
{
|
|
@ -1,10 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace Pterodactyl\Http\Requests\API\Admin\Allocations;
|
||||
namespace Pterodactyl\Http\Requests\Api\Application\Allocations;
|
||||
|
||||
use Pterodactyl\Models\Node;
|
||||
use Pterodactyl\Services\Acl\Api\AdminAcl;
|
||||
use Pterodactyl\Http\Requests\API\Admin\ApiAdminRequest;
|
||||
use Pterodactyl\Http\Requests\Api\Application\ApiAdminRequest;
|
||||
|
||||
class GetAllocationsRequest extends ApiAdminRequest
|
||||
{
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace Pterodactyl\Http\Requests\API\Admin;
|
||||
namespace Pterodactyl\Http\Requests\Api\Application;
|
||||
|
||||
use Pterodactyl\Models\ApiKey;
|
||||
use Pterodactyl\Services\Acl\Api\AdminAcl;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Pterodactyl\Exceptions\PterodactylException;
|
||||
use Pterodactyl\Services\Acl\Api\AdminAcl as Acl;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
abstract class ApiAdminRequest extends FormRequest
|
||||
|
@ -24,7 +24,7 @@ abstract class ApiAdminRequest extends FormRequest
|
|||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $permission = Acl::NONE;
|
||||
protected $permission = AdminAcl::NONE;
|
||||
|
||||
/**
|
||||
* Determine if the current user is authorized to perform
|
||||
|
@ -40,7 +40,7 @@ abstract class ApiAdminRequest extends FormRequest
|
|||
throw new PterodactylException('An ACL resource must be defined on API requests.');
|
||||
}
|
||||
|
||||
return Acl::check($this->key(), $this->resource, $this->permission);
|
||||
return AdminAcl::check($this->key(), $this->resource, $this->permission);
|
||||
}
|
||||
|
||||
/**
|
|
@ -1,10 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace Pterodactyl\Http\Requests\API\Admin\Locations;
|
||||
namespace Pterodactyl\Http\Requests\Api\Application\Locations;
|
||||
|
||||
use Pterodactyl\Models\Location;
|
||||
use Pterodactyl\Services\Acl\Api\AdminAcl;
|
||||
use Pterodactyl\Http\Requests\API\Admin\ApiAdminRequest;
|
||||
use Pterodactyl\Http\Requests\Api\Application\ApiAdminRequest;
|
||||
|
||||
class DeleteLocationRequest extends ApiAdminRequest
|
||||
{
|
|
@ -1,9 +1,9 @@
|
|||
<?php
|
||||
|
||||
namespace Pterodactyl\Http\Controllers\API\Admin\Locations;
|
||||
namespace Pterodactyl\Http\Controllers\Api\Application\Locations;
|
||||
|
||||
use Pterodactyl\Models\Location;
|
||||
use Pterodactyl\Http\Requests\API\Admin\Locations\GetLocationsRequest;
|
||||
use Pterodactyl\Http\Requests\Api\Application\Locations\GetLocationsRequest;
|
||||
|
||||
class GetLocationRequest extends GetLocationsRequest
|
||||
{
|
|
@ -1,9 +1,9 @@
|
|||
<?php
|
||||
|
||||
namespace Pterodactyl\Http\Requests\API\Admin\Locations;
|
||||
namespace Pterodactyl\Http\Requests\Api\Application\Locations;
|
||||
|
||||
use Pterodactyl\Services\Acl\Api\AdminAcl;
|
||||
use Pterodactyl\Http\Requests\API\Admin\ApiAdminRequest;
|
||||
use Pterodactyl\Http\Requests\Api\Application\ApiAdminRequest;
|
||||
|
||||
class GetLocationsRequest extends ApiAdminRequest
|
||||
{
|
|
@ -1,10 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace Pterodactyl\Http\Controllers\API\Admin\Locations;
|
||||
namespace Pterodactyl\Http\Controllers\Api\Application\Locations;
|
||||
|
||||
use Pterodactyl\Models\Location;
|
||||
use Pterodactyl\Services\Acl\Api\AdminAcl;
|
||||
use Pterodactyl\Http\Requests\API\Admin\ApiAdminRequest;
|
||||
use Pterodactyl\Http\Requests\Api\Application\ApiAdminRequest;
|
||||
|
||||
class StoreLocationRequest extends ApiAdminRequest
|
||||
{
|
|
@ -1,9 +1,9 @@
|
|||
<?php
|
||||
|
||||
namespace Pterodactyl\Http\Requests\API\Admin\Locations;
|
||||
namespace Pterodactyl\Http\Requests\Api\Application\Locations;
|
||||
|
||||
use Pterodactyl\Models\Location;
|
||||
use Pterodactyl\Http\Controllers\API\Admin\Locations\StoreLocationRequest;
|
||||
use Pterodactyl\Http\Controllers\Api\Application\Locations\StoreLocationRequest;
|
||||
|
||||
class UpdateLocationRequest extends StoreLocationRequest
|
||||
{
|
|
@ -1,10 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace Pterodactyl\Http\Requests\API\Admin\Nodes;
|
||||
namespace Pterodactyl\Http\Requests\Api\Application\Nodes;
|
||||
|
||||
use Pterodactyl\Models\Node;
|
||||
use Pterodactyl\Services\Acl\Api\AdminAcl;
|
||||
use Pterodactyl\Http\Requests\API\Admin\ApiAdminRequest;
|
||||
use Pterodactyl\Http\Requests\Api\Application\ApiAdminRequest;
|
||||
|
||||
class DeleteNodeRequest extends ApiAdminRequest
|
||||
{
|
|
@ -1,9 +1,9 @@
|
|||
<?php
|
||||
|
||||
namespace Pterodactyl\Http\Requests\API\Admin\Nodes;
|
||||
namespace Pterodactyl\Http\Requests\Api\Application\Nodes;
|
||||
|
||||
use Pterodactyl\Models\Node;
|
||||
use Pterodactyl\Http\Requests\API\Admin\ApiAdminRequest;
|
||||
use Pterodactyl\Http\Requests\Api\Application\ApiAdminRequest;
|
||||
|
||||
class GetNodeRequest extends ApiAdminRequest
|
||||
{
|
|
@ -1,9 +1,9 @@
|
|||
<?php
|
||||
|
||||
namespace Pterodactyl\Http\Requests\API\Admin\Nodes;
|
||||
namespace Pterodactyl\Http\Requests\Api\Application\Nodes;
|
||||
|
||||
use Pterodactyl\Services\Acl\Api\AdminAcl;
|
||||
use Pterodactyl\Http\Requests\API\Admin\ApiAdminRequest;
|
||||
use Pterodactyl\Http\Requests\Api\Application\ApiAdminRequest;
|
||||
|
||||
class GetNodesRequest extends ApiAdminRequest
|
||||
{
|
|
@ -1,10 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace Pterodactyl\Http\Requests\API\Admin\Nodes;
|
||||
namespace Pterodactyl\Http\Requests\Api\Application\Nodes;
|
||||
|
||||
use Pterodactyl\Models\Node;
|
||||
use Pterodactyl\Services\Acl\Api\AdminAcl;
|
||||
use Pterodactyl\Http\Requests\API\Admin\ApiAdminRequest;
|
||||
use Pterodactyl\Http\Requests\Api\Application\ApiAdminRequest;
|
||||
|
||||
class StoreNodeRequest extends ApiAdminRequest
|
||||
{
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Pterodactyl\Http\Requests\API\Admin\Nodes;
|
||||
namespace Pterodactyl\Http\Requests\Api\Application\Nodes;
|
||||
|
||||
use Pterodactyl\Models\Node;
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace Pterodactyl\Http\Requests\API\Admin\Users;
|
||||
namespace Pterodactyl\Http\Requests\Api\Application\Users;
|
||||
|
||||
use Pterodactyl\Models\User;
|
||||
use Pterodactyl\Services\Acl\Api\AdminAcl;
|
||||
use Pterodactyl\Http\Requests\API\Admin\ApiAdminRequest;
|
||||
use Pterodactyl\Http\Requests\Api\Application\ApiAdminRequest;
|
||||
|
||||
class DeleteUserRequest extends ApiAdminRequest
|
||||
{
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Pterodactyl\Http\Requests\API\Admin\Users;
|
||||
namespace Pterodactyl\Http\Requests\Api\Application\Users;
|
||||
|
||||
use Pterodactyl\Models\User;
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
<?php
|
||||
|
||||
namespace Pterodactyl\Http\Requests\API\Admin\Users;
|
||||
namespace Pterodactyl\Http\Requests\Api\Application\Users;
|
||||
|
||||
use Pterodactyl\Services\Acl\Api\AdminAcl as Acl;
|
||||
use Pterodactyl\Http\Requests\API\Admin\ApiAdminRequest;
|
||||
use Pterodactyl\Http\Requests\Api\Application\ApiAdminRequest;
|
||||
|
||||
class GetUsersRequest extends ApiAdminRequest
|
||||
{
|
|
@ -1,10 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace Pterodactyl\Http\Requests\API\Admin\Users;
|
||||
namespace Pterodactyl\Http\Requests\Api\Application\Users;
|
||||
|
||||
use Pterodactyl\Models\User;
|
||||
use Pterodactyl\Services\Acl\Api\AdminAcl;
|
||||
use Pterodactyl\Http\Requests\API\Admin\ApiAdminRequest;
|
||||
use Pterodactyl\Http\Requests\Api\Application\ApiAdminRequest;
|
||||
|
||||
class StoreUserRequest extends ApiAdminRequest
|
||||
{
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Pterodactyl\Http\Requests\API\Admin\Users;
|
||||
namespace Pterodactyl\Http\Requests\Api\Application\Users;
|
||||
|
||||
use Pterodactyl\Models\User;
|
||||
|
|
@ -45,12 +45,12 @@ class RouteServiceProvider extends ServiceProvider
|
|||
->namespace($this->namespace . '\Server')
|
||||
->group(base_path('routes/server.php'));
|
||||
|
||||
Route::middleware(['api'])->prefix('/api/admin')
|
||||
->namespace($this->namespace . '\API\Admin')
|
||||
->group(base_path('routes/api-admin.php'));
|
||||
Route::middleware(['api'])->prefix('/api/application')
|
||||
->namespace($this->namespace . '\Api\Application')
|
||||
->group(base_path('routes/api-application.php'));
|
||||
|
||||
Route::middleware(['daemon'])->prefix('/api/remote')
|
||||
->namespace($this->namespace . '\API\Remote')
|
||||
->namespace($this->namespace . '\Api\Remote')
|
||||
->group(base_path('routes/api-remote.php'));
|
||||
|
||||
Route::middleware(['web', 'daemon-old'])->prefix('/daemon')
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -10,7 +10,7 @@ use Pterodactyl\Models\Allocation;
|
|||
| User Controller Routes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Endpoint: /api/admin/users
|
||||
| Endpoint: /api/application/users
|
||||
|
|
||||
*/
|
||||
Route::group(['prefix' => '/users'], function () {
|
||||
|
@ -32,7 +32,7 @@ Route::group(['prefix' => '/users'], function () {
|
|||
| Node Controller Routes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Endpoint: /api/admin/nodes
|
||||
| Endpoint: /api/application/nodes
|
||||
|
|
||||
*/
|
||||
Route::group(['prefix' => '/nodes'], function () {
|
||||
|
@ -64,7 +64,7 @@ Route::group(['prefix' => '/nodes'], function () {
|
|||
| Location Controller Routes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Endpoint: /api/admin/locations
|
||||
| Endpoint: /api/application/locations
|
||||
|
|
||||
*/
|
||||
Route::group(['prefix' => '/locations'], function () {
|
|
@ -4,7 +4,7 @@ namespace Tests\Unit\Http\Middleware\Api\Admin;
|
|||
|
||||
use Pterodactyl\Models\ApiKey;
|
||||
use Tests\Unit\Http\Middleware\MiddlewareTestCase;
|
||||
use Pterodactyl\Http\Middleware\Api\Admin\AuthenticateIPAccess;
|
||||
use Pterodactyl\Http\Middleware\Api\Application\AuthenticateIPAccess;
|
||||
|
||||
class AuthenticateIPAccessTest extends MiddlewareTestCase
|
||||
{
|
||||
|
@ -65,7 +65,7 @@ class AuthenticateIPAccessTest extends MiddlewareTestCase
|
|||
/**
|
||||
* Return an instance of the middleware to be used when testing.
|
||||
*
|
||||
* @return \Pterodactyl\Http\Middleware\Api\Admin\AuthenticateIPAccess
|
||||
* @return \Pterodactyl\Http\Middleware\Api\Application\AuthenticateIPAccess
|
||||
*/
|
||||
private function getMiddleware(): AuthenticateIPAccess
|
||||
{
|
||||
|
|
|
@ -9,9 +9,9 @@ use Illuminate\Auth\AuthManager;
|
|||
use Illuminate\Contracts\Encryption\Encrypter;
|
||||
use Tests\Unit\Http\Middleware\MiddlewareTestCase;
|
||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
use Pterodactyl\Http\Middleware\Api\Admin\AuthenticateKey;
|
||||
use Pterodactyl\Exceptions\Repository\RecordNotFoundException;
|
||||
use Pterodactyl\Contracts\Repository\ApiKeyRepositoryInterface;
|
||||
use Pterodactyl\Http\Middleware\Api\Application\AuthenticateKey;
|
||||
|
||||
class AuthenticateKeyTest extends MiddlewareTestCase
|
||||
{
|
||||
|
@ -117,7 +117,7 @@ class AuthenticateKeyTest extends MiddlewareTestCase
|
|||
/**
|
||||
* Return an instance of the middleware with mocked dependencies for testing.
|
||||
*
|
||||
* @return \Pterodactyl\Http\Middleware\Api\Admin\AuthenticateKey
|
||||
* @return \Pterodactyl\Http\Middleware\Api\Application\AuthenticateKey
|
||||
*/
|
||||
private function getMiddleware(): AuthenticateKey
|
||||
{
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace Tests\Unit\Http\Middleware\Api\Admin;
|
||||
|
||||
use Tests\Unit\Http\Middleware\MiddlewareTestCase;
|
||||
use Pterodactyl\Http\Middleware\Api\Admin\AuthenticateUser;
|
||||
use Pterodactyl\Http\Middleware\Api\Application\AuthenticateUser;
|
||||
|
||||
class AuthenticateUserTest extends MiddlewareTestCase
|
||||
{
|
||||
|
@ -44,7 +44,7 @@ class AuthenticateUserTest extends MiddlewareTestCase
|
|||
/**
|
||||
* Return an instance of the middleware for testing.
|
||||
*
|
||||
* @return \Pterodactyl\Http\Middleware\Api\Admin\AuthenticateUser
|
||||
* @return \Pterodactyl\Http\Middleware\Api\Application\AuthenticateUser
|
||||
*/
|
||||
private function getMiddleware(): AuthenticateUser
|
||||
{
|
||||
|
|
|
@ -7,7 +7,7 @@ use Barryvdh\Debugbar\LaravelDebugbar;
|
|||
use Illuminate\Contracts\Config\Repository;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
use Tests\Unit\Http\Middleware\MiddlewareTestCase;
|
||||
use Pterodactyl\Http\Middleware\Api\Admin\SetSessionDriver;
|
||||
use Pterodactyl\Http\Middleware\Api\Application\SetSessionDriver;
|
||||
|
||||
class SetSessionDriverTest extends MiddlewareTestCase
|
||||
{
|
||||
|
@ -60,7 +60,7 @@ class SetSessionDriverTest extends MiddlewareTestCase
|
|||
/**
|
||||
* Return an instance of the middleware with mocked dependencies for testing.
|
||||
*
|
||||
* @return \Pterodactyl\Http\Middleware\Api\Admin\SetSessionDriver
|
||||
* @return \Pterodactyl\Http\Middleware\Api\Application\SetSessionDriver
|
||||
*/
|
||||
private function getMiddleware(): SetSessionDriver
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue