Reorganize API files

This commit is contained in:
Dane Everitt 2018-01-19 19:58:57 -06:00
parent bdadec002c
commit 0e7f8cedf0
No known key found for this signature in database
GPG Key ID: EEA66103B3D71F53
41 changed files with 156 additions and 111 deletions

View File

@ -1,6 +1,6 @@
<?php <?php
namespace Pterodactyl\Http\Controllers\API\Remote; namespace Pterodactyl\Http\Controllers\Api\Remote;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Http\JsonResponse; use Illuminate\Http\JsonResponse;

View File

@ -7,7 +7,7 @@
* https://opensource.org/licenses/MIT * https://opensource.org/licenses/MIT
*/ */
namespace Pterodactyl\Http\Controllers\API\Remote; namespace Pterodactyl\Http\Controllers\Api\Remote;
use Illuminate\Http\JsonResponse; use Illuminate\Http\JsonResponse;
use Pterodactyl\Http\Controllers\Controller; use Pterodactyl\Http\Controllers\Controller;

View File

@ -1,6 +1,6 @@
<?php <?php
namespace Pterodactyl\Http\Controllers\API\Remote; namespace Pterodactyl\Http\Controllers\Api\Remote;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Http\JsonResponse; use Illuminate\Http\JsonResponse;

View File

@ -22,7 +22,7 @@
* SOFTWARE. * SOFTWARE.
*/ */
namespace Pterodactyl\Http\Controllers\API\Remote; namespace Pterodactyl\Http\Controllers\Api\Remote;
use Spatie\Fractal\Fractal; use Spatie\Fractal\Fractal;
use Pterodactyl\Http\Controllers\Controller; use Pterodactyl\Http\Controllers\Controller;

View File

@ -0,0 +1 @@
<?php

View File

@ -1,6 +1,6 @@
<?php <?php
namespace Pterodactyl\Http\Controllers\API\Admin\Locations; namespace Pterodactyl\Http\Controllers\Api\Application\Locations;
use Spatie\Fractal\Fractal; use Spatie\Fractal\Fractal;
use Illuminate\Http\Response; use Illuminate\Http\Response;
@ -13,9 +13,9 @@ use Pterodactyl\Services\Locations\LocationCreationService;
use Pterodactyl\Services\Locations\LocationDeletionService; use Pterodactyl\Services\Locations\LocationDeletionService;
use Pterodactyl\Transformers\Api\Admin\LocationTransformer; use Pterodactyl\Transformers\Api\Admin\LocationTransformer;
use Pterodactyl\Contracts\Repository\LocationRepositoryInterface; use Pterodactyl\Contracts\Repository\LocationRepositoryInterface;
use Pterodactyl\Http\Requests\API\Admin\Locations\GetLocationsRequest; use Pterodactyl\Http\Requests\Api\Application\Locations\GetLocationsRequest;
use Pterodactyl\Http\Requests\API\Admin\Locations\DeleteLocationRequest; use Pterodactyl\Http\Requests\Api\Application\Locations\DeleteLocationRequest;
use Pterodactyl\Http\Requests\API\Admin\Locations\UpdateLocationRequest; use Pterodactyl\Http\Requests\Api\Application\Locations\UpdateLocationRequest;
class LocationController extends Controller class LocationController extends Controller
{ {
@ -70,7 +70,7 @@ class LocationController extends Controller
/** /**
* Return all of the locations currently registered on the Panel. * 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 * @return array
*/ */
public function index(GetLocationsRequest $request): array public function index(GetLocationsRequest $request): array
@ -87,8 +87,8 @@ class LocationController extends Controller
/** /**
* Return a single location. * Return a single location.
* *
* @param \Pterodactyl\Http\Controllers\API\Admin\Locations\GetLocationRequest $request * @param \Pterodactyl\Http\Controllers\Api\Application\Locations\GetLocationRequest $request
* @param \Pterodactyl\Models\Location $location * @param \Pterodactyl\Models\Location $location
* @return array * @return array
*/ */
public function view(GetLocationRequest $request, Location $location): 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 * Store a new location on the Panel and return a HTTP/201 response code with the
* new location attached. * 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 * @return \Illuminate\Http\JsonResponse
* *
* @throws \Pterodactyl\Exceptions\Model\DataValidationException * @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. * 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\Http\Requests\Api\Application\Locations\UpdateLocationRequest $request
* @param \Pterodactyl\Models\Location $location * @param \Pterodactyl\Models\Location $location
* @return array * @return array
* *
* @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Model\DataValidationException
@ -141,8 +141,8 @@ class LocationController extends Controller
/** /**
* Delete a location from the Panel. * Delete a location from the Panel.
* *
* @param \Pterodactyl\Http\Requests\API\Admin\Locations\DeleteLocationRequest $request * @param \Pterodactyl\Http\Requests\Api\Application\Locations\DeleteLocationRequest $request
* @param \Pterodactyl\Models\Location $location * @param \Pterodactyl\Models\Location $location
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
* *
* @throws \Pterodactyl\Exceptions\Service\Location\HasActiveNodesException * @throws \Pterodactyl\Exceptions\Service\Location\HasActiveNodesException

View File

@ -1,6 +1,6 @@
<?php <?php
namespace Pterodactyl\Http\Controllers\API\Admin\Nodes; namespace Pterodactyl\Http\Controllers\Api\Application\Nodes;
use Spatie\Fractal\Fractal; use Spatie\Fractal\Fractal;
use Pterodactyl\Models\Node; use Pterodactyl\Models\Node;
@ -11,8 +11,8 @@ use League\Fractal\Pagination\IlluminatePaginatorAdapter;
use Pterodactyl\Transformers\Api\Admin\AllocationTransformer; use Pterodactyl\Transformers\Api\Admin\AllocationTransformer;
use Pterodactyl\Services\Allocations\AllocationDeletionService; use Pterodactyl\Services\Allocations\AllocationDeletionService;
use Pterodactyl\Contracts\Repository\AllocationRepositoryInterface; use Pterodactyl\Contracts\Repository\AllocationRepositoryInterface;
use Pterodactyl\Http\Requests\API\Admin\Allocations\GetAllocationsRequest; use Pterodactyl\Http\Requests\Api\Application\Allocations\GetAllocationsRequest;
use Pterodactyl\Http\Requests\API\Admin\Allocations\DeleteAllocationRequest; use Pterodactyl\Http\Requests\Api\Application\Allocations\DeleteAllocationRequest;
class AllocationController extends Controller class AllocationController extends Controller
{ {
@ -48,8 +48,8 @@ class AllocationController extends Controller
/** /**
* Return all of the allocations that exist for a given node. * Return all of the allocations that exist for a given node.
* *
* @param \Pterodactyl\Http\Requests\API\Admin\Allocations\GetAllocationsRequest $request * @param \Pterodactyl\Http\Requests\Api\Application\Allocations\GetAllocationsRequest $request
* @param \Pterodactyl\Models\Node $node * @param \Pterodactyl\Models\Node $node
* @return array * @return array
*/ */
public function index(GetAllocationsRequest $request, Node $node): array public function index(GetAllocationsRequest $request, Node $node): array
@ -66,9 +66,9 @@ class AllocationController extends Controller
/** /**
* Delete a specific allocation from the Panel. * Delete a specific allocation from the Panel.
* *
* @param \Pterodactyl\Http\Requests\API\Admin\Allocations\DeleteAllocationRequest $request * @param \Pterodactyl\Http\Requests\Api\Application\Allocations\DeleteAllocationRequest $request
* @param \Pterodactyl\Models\Node $node * @param \Pterodactyl\Models\Node $node
* @param \Pterodactyl\Models\Allocation $allocation * @param \Pterodactyl\Models\Allocation $allocation
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
* *
* @throws \Pterodactyl\Exceptions\Service\Allocation\ServerUsingAllocationException * @throws \Pterodactyl\Exceptions\Service\Allocation\ServerUsingAllocationException

View File

@ -1,6 +1,6 @@
<?php <?php
namespace Pterodactyl\Http\Controllers\API\Admin\Nodes; namespace Pterodactyl\Http\Controllers\Api\Application\Nodes;
use Spatie\Fractal\Fractal; use Spatie\Fractal\Fractal;
use Pterodactyl\Models\Node; use Pterodactyl\Models\Node;
@ -13,11 +13,11 @@ use Pterodactyl\Services\Nodes\NodeDeletionService;
use Pterodactyl\Transformers\Api\Admin\NodeTransformer; use Pterodactyl\Transformers\Api\Admin\NodeTransformer;
use League\Fractal\Pagination\IlluminatePaginatorAdapter; use League\Fractal\Pagination\IlluminatePaginatorAdapter;
use Pterodactyl\Contracts\Repository\NodeRepositoryInterface; use Pterodactyl\Contracts\Repository\NodeRepositoryInterface;
use Pterodactyl\Http\Requests\API\Admin\Nodes\GetNodeRequest; use Pterodactyl\Http\Requests\Api\Application\Nodes\GetNodeRequest;
use Pterodactyl\Http\Requests\API\Admin\Nodes\GetNodesRequest; use Pterodactyl\Http\Requests\Api\Application\Nodes\GetNodesRequest;
use Pterodactyl\Http\Requests\API\Admin\Nodes\StoreNodeRequest; use Pterodactyl\Http\Requests\Api\Application\Nodes\StoreNodeRequest;
use Pterodactyl\Http\Requests\API\Admin\Nodes\DeleteNodeRequest; use Pterodactyl\Http\Requests\Api\Application\Nodes\DeleteNodeRequest;
use Pterodactyl\Http\Requests\API\Admin\Nodes\UpdateNodeRequest; use Pterodactyl\Http\Requests\Api\Application\Nodes\UpdateNodeRequest;
class NodeController extends Controller class NodeController extends Controller
{ {
@ -72,7 +72,7 @@ class NodeController extends Controller
/** /**
* Return all of the nodes currently available on the Panel. * 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 * @return array
*/ */
public function index(GetNodesRequest $request): array public function index(GetNodesRequest $request): array
@ -89,8 +89,8 @@ class NodeController extends Controller
/** /**
* Return data for a single instance of a node. * Return data for a single instance of a node.
* *
* @param \Pterodactyl\Http\Requests\API\Admin\Nodes\GetNodeRequest $request * @param \Pterodactyl\Http\Requests\Api\Application\Nodes\GetNodeRequest $request
* @param \Pterodactyl\Models\Node $node * @param \Pterodactyl\Models\Node $node
* @return array * @return array
*/ */
public function view(GetNodeRequest $request, Node $node): 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 * Create a new node on the Panel. Returns the created node and a HTTP/201
* status response on success. * 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 * @return \Illuminate\Http\JsonResponse
* *
* @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Model\DataValidationException
@ -126,8 +126,8 @@ class NodeController extends Controller
/** /**
* Update an existing node on the Panel. * Update an existing node on the Panel.
* *
* @param \Pterodactyl\Http\Requests\API\Admin\Nodes\UpdateNodeRequest $request * @param \Pterodactyl\Http\Requests\Api\Application\Nodes\UpdateNodeRequest $request
* @param \Pterodactyl\Models\Node $node * @param \Pterodactyl\Models\Node $node
* @return array * @return array
* *
* @throws \Pterodactyl\Exceptions\DisplayException * @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 * Deletes a given node from the Panel as long as there are no servers
* currently attached to it. * currently attached to it.
* *
* @param \Pterodactyl\Http\Requests\API\Admin\Nodes\DeleteNodeRequest $request * @param \Pterodactyl\Http\Requests\Api\Application\Nodes\DeleteNodeRequest $request
* @param \Pterodactyl\Models\Node $node * @param \Pterodactyl\Models\Node $node
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
* *
* @throws \Pterodactyl\Exceptions\Service\HasActiveServersException * @throws \Pterodactyl\Exceptions\Service\HasActiveServersException

View File

@ -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();
}
}

View File

@ -1,6 +1,6 @@
<?php <?php
namespace Pterodactyl\Http\Controllers\API\Admin\Users; namespace Pterodactyl\Http\Controllers\Api\Application\Users;
use Spatie\Fractal\Fractal; use Spatie\Fractal\Fractal;
use Illuminate\Http\Request; use Illuminate\Http\Request;
@ -14,11 +14,11 @@ use Pterodactyl\Services\Users\UserDeletionService;
use Pterodactyl\Transformers\Api\Admin\UserTransformer; use Pterodactyl\Transformers\Api\Admin\UserTransformer;
use League\Fractal\Pagination\IlluminatePaginatorAdapter; use League\Fractal\Pagination\IlluminatePaginatorAdapter;
use Pterodactyl\Contracts\Repository\UserRepositoryInterface; use Pterodactyl\Contracts\Repository\UserRepositoryInterface;
use Pterodactyl\Http\Requests\API\Admin\Users\GetUserRequest; use Pterodactyl\Http\Requests\Api\Application\Users\GetUserRequest;
use Pterodactyl\Http\Requests\API\Admin\Users\GetUsersRequest; use Pterodactyl\Http\Requests\Api\Application\Users\GetUsersRequest;
use Pterodactyl\Http\Requests\API\Admin\Users\StoreUserRequest; use Pterodactyl\Http\Requests\Api\Application\Users\StoreUserRequest;
use Pterodactyl\Http\Requests\API\Admin\Users\DeleteUserRequest; use Pterodactyl\Http\Requests\Api\Application\Users\DeleteUserRequest;
use Pterodactyl\Http\Requests\API\Admin\Users\UpdateUserRequest; use Pterodactyl\Http\Requests\Api\Application\Users\UpdateUserRequest;
class UserController extends Controller class UserController extends Controller
{ {
@ -75,7 +75,7 @@ class UserController extends Controller
* of a collection of users including any defined relations passed in * of a collection of users including any defined relations passed in
* the request. * the request.
* *
* @param \Pterodactyl\Http\Requests\API\Admin\Users\GetUsersRequest $request * @param \Pterodactyl\Http\Requests\Api\Application\Users\GetUsersRequest $request
* @return array * @return array
*/ */
public function index(GetUsersRequest $request): 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 * Handle a request to view a single user. Includes any relations that
* were defined in the request. * were defined in the request.
* *
* @param \Pterodactyl\Http\Requests\API\Admin\Users\GetUserRequest $request * @param \Pterodactyl\Http\Requests\Api\Application\Users\GetUserRequest $request
* @param \Pterodactyl\Models\User $user * @param \Pterodactyl\Models\User $user
* @return array * @return array
*/ */
public function view(GetUserRequest $request, User $user): 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 * Revocation errors are returned under the 'revocation_errors' key in the response
* meta. If there are no errors this is an empty array. * meta. If there are no errors this is an empty array.
* *
* @param \Pterodactyl\Http\Requests\API\Admin\Users\UpdateUserRequest $request * @param \Pterodactyl\Http\Requests\Api\Application\Users\UpdateUserRequest $request
* @param \Pterodactyl\Models\User $user * @param \Pterodactyl\Models\User $user
* @return array * @return array
* *
* @throws \Pterodactyl\Exceptions\Model\DataValidationException * @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 * Store a new user on the system. Returns the created user and a HTTP/201
* header on successful creation. * 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 * @return \Illuminate\Http\JsonResponse
* *
* @throws \Exception * @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 * Handle a request to delete a user from the Panel. Returns a HTTP/204 response
* on successful deletion. * on successful deletion.
* *
* @param \Pterodactyl\Http\Requests\API\Admin\Users\DeleteUserRequest $request * @param \Pterodactyl\Http\Requests\Api\Application\Users\DeleteUserRequest $request
* @param \Pterodactyl\Models\User $user * @param \Pterodactyl\Models\User $user
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
* *
* @throws \Pterodactyl\Exceptions\DisplayException * @throws \Pterodactyl\Exceptions\DisplayException

View File

@ -19,20 +19,20 @@ use Pterodactyl\Http\Middleware\AccessingValidServer;
use Illuminate\View\Middleware\ShareErrorsFromSession; use Illuminate\View\Middleware\ShareErrorsFromSession;
use Pterodactyl\Http\Middleware\RedirectIfAuthenticated; use Pterodactyl\Http\Middleware\RedirectIfAuthenticated;
use Illuminate\Auth\Middleware\AuthenticateWithBasicAuth; use Illuminate\Auth\Middleware\AuthenticateWithBasicAuth;
use Pterodactyl\Http\Middleware\Api\Admin\AuthenticateKey;
use Illuminate\Foundation\Http\Middleware\ValidatePostSize; 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 Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse;
use Pterodactyl\Http\Middleware\Server\AuthenticateAsSubuser; use Pterodactyl\Http\Middleware\Server\AuthenticateAsSubuser;
use Pterodactyl\Http\Middleware\Api\Daemon\DaemonAuthenticate; use Pterodactyl\Http\Middleware\Api\Daemon\DaemonAuthenticate;
use Pterodactyl\Http\Middleware\Server\SubuserBelongsToServer; use Pterodactyl\Http\Middleware\Server\SubuserBelongsToServer;
use Pterodactyl\Http\Middleware\Api\Admin\AuthenticateIPAccess;
use Pterodactyl\Http\Middleware\RequireTwoFactorAuthentication; use Pterodactyl\Http\Middleware\RequireTwoFactorAuthentication;
use Pterodactyl\Http\Middleware\Server\DatabaseBelongsToServer; use Pterodactyl\Http\Middleware\Server\DatabaseBelongsToServer;
use Pterodactyl\Http\Middleware\Server\ScheduleBelongsToServer; 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\CheckForMaintenanceMode;
use Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull; use Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull;
use Pterodactyl\Http\Middleware\Api\Application\AuthenticateIPAccess;
use Pterodactyl\Http\Middleware\DaemonAuthenticate as OldDaemonAuthenticate; use Pterodactyl\Http\Middleware\DaemonAuthenticate as OldDaemonAuthenticate;
class Kernel extends HttpKernel class Kernel extends HttpKernel

View File

@ -1,6 +1,6 @@
<?php <?php
namespace Pterodactyl\Http\Middleware\Api\Admin; namespace Pterodactyl\Http\Middleware\Api\Application;
use Closure; use Closure;
use IPTools\IP; use IPTools\IP;

View File

@ -1,6 +1,6 @@
<?php <?php
namespace Pterodactyl\Http\Middleware\Api\Admin; namespace Pterodactyl\Http\Middleware\Api\Application;
use Closure; use Closure;
use Cake\Chronos\Chronos; use Cake\Chronos\Chronos;

View File

@ -1,6 +1,6 @@
<?php <?php
namespace Pterodactyl\Http\Middleware\Api\Admin; namespace Pterodactyl\Http\Middleware\Api\Application;
use Closure; use Closure;
use Illuminate\Http\Request; use Illuminate\Http\Request;

View File

@ -1,6 +1,6 @@
<?php <?php
namespace Pterodactyl\Http\Middleware\Api\Admin; namespace Pterodactyl\Http\Middleware\Api\Application;
use Closure; use Closure;
use Illuminate\Http\Request; use Illuminate\Http\Request;

View File

@ -1,11 +1,11 @@
<?php <?php
namespace Pterodactyl\Http\Requests\API\Admin\Allocations; namespace Pterodactyl\Http\Requests\Api\Application\Allocations;
use Pterodactyl\Models\Node; use Pterodactyl\Models\Node;
use Pterodactyl\Models\Allocation; use Pterodactyl\Models\Allocation;
use Pterodactyl\Services\Acl\Api\AdminAcl; use Pterodactyl\Services\Acl\Api\AdminAcl;
use Pterodactyl\Http\Requests\API\Admin\ApiAdminRequest; use Pterodactyl\Http\Requests\Api\Application\ApiAdminRequest;
class DeleteAllocationRequest extends ApiAdminRequest class DeleteAllocationRequest extends ApiAdminRequest
{ {

View File

@ -1,10 +1,10 @@
<?php <?php
namespace Pterodactyl\Http\Requests\API\Admin\Allocations; namespace Pterodactyl\Http\Requests\Api\Application\Allocations;
use Pterodactyl\Models\Node; use Pterodactyl\Models\Node;
use Pterodactyl\Services\Acl\Api\AdminAcl; use Pterodactyl\Services\Acl\Api\AdminAcl;
use Pterodactyl\Http\Requests\API\Admin\ApiAdminRequest; use Pterodactyl\Http\Requests\Api\Application\ApiAdminRequest;
class GetAllocationsRequest extends ApiAdminRequest class GetAllocationsRequest extends ApiAdminRequest
{ {

View File

@ -1,11 +1,11 @@
<?php <?php
namespace Pterodactyl\Http\Requests\API\Admin; namespace Pterodactyl\Http\Requests\Api\Application;
use Pterodactyl\Models\ApiKey; use Pterodactyl\Models\ApiKey;
use Pterodactyl\Services\Acl\Api\AdminAcl;
use Illuminate\Foundation\Http\FormRequest; use Illuminate\Foundation\Http\FormRequest;
use Pterodactyl\Exceptions\PterodactylException; use Pterodactyl\Exceptions\PterodactylException;
use Pterodactyl\Services\Acl\Api\AdminAcl as Acl;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
abstract class ApiAdminRequest extends FormRequest abstract class ApiAdminRequest extends FormRequest
@ -24,7 +24,7 @@ abstract class ApiAdminRequest extends FormRequest
* *
* @var int * @var int
*/ */
protected $permission = Acl::NONE; protected $permission = AdminAcl::NONE;
/** /**
* Determine if the current user is authorized to perform * 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.'); 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);
} }
/** /**

View File

@ -1,10 +1,10 @@
<?php <?php
namespace Pterodactyl\Http\Requests\API\Admin\Locations; namespace Pterodactyl\Http\Requests\Api\Application\Locations;
use Pterodactyl\Models\Location; use Pterodactyl\Models\Location;
use Pterodactyl\Services\Acl\Api\AdminAcl; use Pterodactyl\Services\Acl\Api\AdminAcl;
use Pterodactyl\Http\Requests\API\Admin\ApiAdminRequest; use Pterodactyl\Http\Requests\Api\Application\ApiAdminRequest;
class DeleteLocationRequest extends ApiAdminRequest class DeleteLocationRequest extends ApiAdminRequest
{ {

View File

@ -1,9 +1,9 @@
<?php <?php
namespace Pterodactyl\Http\Controllers\API\Admin\Locations; namespace Pterodactyl\Http\Controllers\Api\Application\Locations;
use Pterodactyl\Models\Location; use Pterodactyl\Models\Location;
use Pterodactyl\Http\Requests\API\Admin\Locations\GetLocationsRequest; use Pterodactyl\Http\Requests\Api\Application\Locations\GetLocationsRequest;
class GetLocationRequest extends GetLocationsRequest class GetLocationRequest extends GetLocationsRequest
{ {

View File

@ -1,9 +1,9 @@
<?php <?php
namespace Pterodactyl\Http\Requests\API\Admin\Locations; namespace Pterodactyl\Http\Requests\Api\Application\Locations;
use Pterodactyl\Services\Acl\Api\AdminAcl; use Pterodactyl\Services\Acl\Api\AdminAcl;
use Pterodactyl\Http\Requests\API\Admin\ApiAdminRequest; use Pterodactyl\Http\Requests\Api\Application\ApiAdminRequest;
class GetLocationsRequest extends ApiAdminRequest class GetLocationsRequest extends ApiAdminRequest
{ {

View File

@ -1,10 +1,10 @@
<?php <?php
namespace Pterodactyl\Http\Controllers\API\Admin\Locations; namespace Pterodactyl\Http\Controllers\Api\Application\Locations;
use Pterodactyl\Models\Location; use Pterodactyl\Models\Location;
use Pterodactyl\Services\Acl\Api\AdminAcl; use Pterodactyl\Services\Acl\Api\AdminAcl;
use Pterodactyl\Http\Requests\API\Admin\ApiAdminRequest; use Pterodactyl\Http\Requests\Api\Application\ApiAdminRequest;
class StoreLocationRequest extends ApiAdminRequest class StoreLocationRequest extends ApiAdminRequest
{ {

View File

@ -1,9 +1,9 @@
<?php <?php
namespace Pterodactyl\Http\Requests\API\Admin\Locations; namespace Pterodactyl\Http\Requests\Api\Application\Locations;
use Pterodactyl\Models\Location; use Pterodactyl\Models\Location;
use Pterodactyl\Http\Controllers\API\Admin\Locations\StoreLocationRequest; use Pterodactyl\Http\Controllers\Api\Application\Locations\StoreLocationRequest;
class UpdateLocationRequest extends StoreLocationRequest class UpdateLocationRequest extends StoreLocationRequest
{ {

View File

@ -1,10 +1,10 @@
<?php <?php
namespace Pterodactyl\Http\Requests\API\Admin\Nodes; namespace Pterodactyl\Http\Requests\Api\Application\Nodes;
use Pterodactyl\Models\Node; use Pterodactyl\Models\Node;
use Pterodactyl\Services\Acl\Api\AdminAcl; use Pterodactyl\Services\Acl\Api\AdminAcl;
use Pterodactyl\Http\Requests\API\Admin\ApiAdminRequest; use Pterodactyl\Http\Requests\Api\Application\ApiAdminRequest;
class DeleteNodeRequest extends ApiAdminRequest class DeleteNodeRequest extends ApiAdminRequest
{ {

View File

@ -1,9 +1,9 @@
<?php <?php
namespace Pterodactyl\Http\Requests\API\Admin\Nodes; namespace Pterodactyl\Http\Requests\Api\Application\Nodes;
use Pterodactyl\Models\Node; use Pterodactyl\Models\Node;
use Pterodactyl\Http\Requests\API\Admin\ApiAdminRequest; use Pterodactyl\Http\Requests\Api\Application\ApiAdminRequest;
class GetNodeRequest extends ApiAdminRequest class GetNodeRequest extends ApiAdminRequest
{ {

View File

@ -1,9 +1,9 @@
<?php <?php
namespace Pterodactyl\Http\Requests\API\Admin\Nodes; namespace Pterodactyl\Http\Requests\Api\Application\Nodes;
use Pterodactyl\Services\Acl\Api\AdminAcl; use Pterodactyl\Services\Acl\Api\AdminAcl;
use Pterodactyl\Http\Requests\API\Admin\ApiAdminRequest; use Pterodactyl\Http\Requests\Api\Application\ApiAdminRequest;
class GetNodesRequest extends ApiAdminRequest class GetNodesRequest extends ApiAdminRequest
{ {

View File

@ -1,10 +1,10 @@
<?php <?php
namespace Pterodactyl\Http\Requests\API\Admin\Nodes; namespace Pterodactyl\Http\Requests\Api\Application\Nodes;
use Pterodactyl\Models\Node; use Pterodactyl\Models\Node;
use Pterodactyl\Services\Acl\Api\AdminAcl; use Pterodactyl\Services\Acl\Api\AdminAcl;
use Pterodactyl\Http\Requests\API\Admin\ApiAdminRequest; use Pterodactyl\Http\Requests\Api\Application\ApiAdminRequest;
class StoreNodeRequest extends ApiAdminRequest class StoreNodeRequest extends ApiAdminRequest
{ {

View File

@ -1,6 +1,6 @@
<?php <?php
namespace Pterodactyl\Http\Requests\API\Admin\Nodes; namespace Pterodactyl\Http\Requests\Api\Application\Nodes;
use Pterodactyl\Models\Node; use Pterodactyl\Models\Node;

View File

@ -1,10 +1,10 @@
<?php <?php
namespace Pterodactyl\Http\Requests\API\Admin\Users; namespace Pterodactyl\Http\Requests\Api\Application\Users;
use Pterodactyl\Models\User; use Pterodactyl\Models\User;
use Pterodactyl\Services\Acl\Api\AdminAcl; use Pterodactyl\Services\Acl\Api\AdminAcl;
use Pterodactyl\Http\Requests\API\Admin\ApiAdminRequest; use Pterodactyl\Http\Requests\Api\Application\ApiAdminRequest;
class DeleteUserRequest extends ApiAdminRequest class DeleteUserRequest extends ApiAdminRequest
{ {

View File

@ -1,6 +1,6 @@
<?php <?php
namespace Pterodactyl\Http\Requests\API\Admin\Users; namespace Pterodactyl\Http\Requests\Api\Application\Users;
use Pterodactyl\Models\User; use Pterodactyl\Models\User;

View File

@ -1,9 +1,9 @@
<?php <?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\Services\Acl\Api\AdminAcl as Acl;
use Pterodactyl\Http\Requests\API\Admin\ApiAdminRequest; use Pterodactyl\Http\Requests\Api\Application\ApiAdminRequest;
class GetUsersRequest extends ApiAdminRequest class GetUsersRequest extends ApiAdminRequest
{ {

View File

@ -1,10 +1,10 @@
<?php <?php
namespace Pterodactyl\Http\Requests\API\Admin\Users; namespace Pterodactyl\Http\Requests\Api\Application\Users;
use Pterodactyl\Models\User; use Pterodactyl\Models\User;
use Pterodactyl\Services\Acl\Api\AdminAcl; use Pterodactyl\Services\Acl\Api\AdminAcl;
use Pterodactyl\Http\Requests\API\Admin\ApiAdminRequest; use Pterodactyl\Http\Requests\Api\Application\ApiAdminRequest;
class StoreUserRequest extends ApiAdminRequest class StoreUserRequest extends ApiAdminRequest
{ {

View File

@ -1,6 +1,6 @@
<?php <?php
namespace Pterodactyl\Http\Requests\API\Admin\Users; namespace Pterodactyl\Http\Requests\Api\Application\Users;
use Pterodactyl\Models\User; use Pterodactyl\Models\User;

View File

@ -45,12 +45,12 @@ class RouteServiceProvider extends ServiceProvider
->namespace($this->namespace . '\Server') ->namespace($this->namespace . '\Server')
->group(base_path('routes/server.php')); ->group(base_path('routes/server.php'));
Route::middleware(['api'])->prefix('/api/admin') Route::middleware(['api'])->prefix('/api/application')
->namespace($this->namespace . '\API\Admin') ->namespace($this->namespace . '\Api\Application')
->group(base_path('routes/api-admin.php')); ->group(base_path('routes/api-application.php'));
Route::middleware(['daemon'])->prefix('/api/remote') Route::middleware(['daemon'])->prefix('/api/remote')
->namespace($this->namespace . '\API\Remote') ->namespace($this->namespace . '\Api\Remote')
->group(base_path('routes/api-remote.php')); ->group(base_path('routes/api-remote.php'));
Route::middleware(['web', 'daemon-old'])->prefix('/daemon') Route::middleware(['web', 'daemon-old'])->prefix('/daemon')

File diff suppressed because one or more lines are too long

View File

@ -10,7 +10,7 @@ use Pterodactyl\Models\Allocation;
| User Controller Routes | User Controller Routes
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Endpoint: /api/admin/users | Endpoint: /api/application/users
| |
*/ */
Route::group(['prefix' => '/users'], function () { Route::group(['prefix' => '/users'], function () {
@ -32,7 +32,7 @@ Route::group(['prefix' => '/users'], function () {
| Node Controller Routes | Node Controller Routes
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Endpoint: /api/admin/nodes | Endpoint: /api/application/nodes
| |
*/ */
Route::group(['prefix' => '/nodes'], function () { Route::group(['prefix' => '/nodes'], function () {
@ -64,7 +64,7 @@ Route::group(['prefix' => '/nodes'], function () {
| Location Controller Routes | Location Controller Routes
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Endpoint: /api/admin/locations | Endpoint: /api/application/locations
| |
*/ */
Route::group(['prefix' => '/locations'], function () { Route::group(['prefix' => '/locations'], function () {

View File

@ -4,7 +4,7 @@ namespace Tests\Unit\Http\Middleware\Api\Admin;
use Pterodactyl\Models\ApiKey; use Pterodactyl\Models\ApiKey;
use Tests\Unit\Http\Middleware\MiddlewareTestCase; use Tests\Unit\Http\Middleware\MiddlewareTestCase;
use Pterodactyl\Http\Middleware\Api\Admin\AuthenticateIPAccess; use Pterodactyl\Http\Middleware\Api\Application\AuthenticateIPAccess;
class AuthenticateIPAccessTest extends MiddlewareTestCase class AuthenticateIPAccessTest extends MiddlewareTestCase
{ {
@ -65,7 +65,7 @@ class AuthenticateIPAccessTest extends MiddlewareTestCase
/** /**
* Return an instance of the middleware to be used when testing. * 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 private function getMiddleware(): AuthenticateIPAccess
{ {

View File

@ -9,9 +9,9 @@ use Illuminate\Auth\AuthManager;
use Illuminate\Contracts\Encryption\Encrypter; use Illuminate\Contracts\Encryption\Encrypter;
use Tests\Unit\Http\Middleware\MiddlewareTestCase; use Tests\Unit\Http\Middleware\MiddlewareTestCase;
use Symfony\Component\HttpKernel\Exception\HttpException; use Symfony\Component\HttpKernel\Exception\HttpException;
use Pterodactyl\Http\Middleware\Api\Admin\AuthenticateKey;
use Pterodactyl\Exceptions\Repository\RecordNotFoundException; use Pterodactyl\Exceptions\Repository\RecordNotFoundException;
use Pterodactyl\Contracts\Repository\ApiKeyRepositoryInterface; use Pterodactyl\Contracts\Repository\ApiKeyRepositoryInterface;
use Pterodactyl\Http\Middleware\Api\Application\AuthenticateKey;
class AuthenticateKeyTest extends MiddlewareTestCase class AuthenticateKeyTest extends MiddlewareTestCase
{ {
@ -117,7 +117,7 @@ class AuthenticateKeyTest extends MiddlewareTestCase
/** /**
* Return an instance of the middleware with mocked dependencies for testing. * 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 private function getMiddleware(): AuthenticateKey
{ {

View File

@ -3,7 +3,7 @@
namespace Tests\Unit\Http\Middleware\Api\Admin; namespace Tests\Unit\Http\Middleware\Api\Admin;
use Tests\Unit\Http\Middleware\MiddlewareTestCase; use Tests\Unit\Http\Middleware\MiddlewareTestCase;
use Pterodactyl\Http\Middleware\Api\Admin\AuthenticateUser; use Pterodactyl\Http\Middleware\Api\Application\AuthenticateUser;
class AuthenticateUserTest extends MiddlewareTestCase class AuthenticateUserTest extends MiddlewareTestCase
{ {
@ -44,7 +44,7 @@ class AuthenticateUserTest extends MiddlewareTestCase
/** /**
* Return an instance of the middleware for testing. * 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 private function getMiddleware(): AuthenticateUser
{ {

View File

@ -7,7 +7,7 @@ use Barryvdh\Debugbar\LaravelDebugbar;
use Illuminate\Contracts\Config\Repository; use Illuminate\Contracts\Config\Repository;
use Illuminate\Contracts\Foundation\Application; use Illuminate\Contracts\Foundation\Application;
use Tests\Unit\Http\Middleware\MiddlewareTestCase; use Tests\Unit\Http\Middleware\MiddlewareTestCase;
use Pterodactyl\Http\Middleware\Api\Admin\SetSessionDriver; use Pterodactyl\Http\Middleware\Api\Application\SetSessionDriver;
class SetSessionDriverTest extends MiddlewareTestCase class SetSessionDriverTest extends MiddlewareTestCase
{ {
@ -60,7 +60,7 @@ class SetSessionDriverTest extends MiddlewareTestCase
/** /**
* Return an instance of the middleware with mocked dependencies for testing. * 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 private function getMiddleware(): SetSessionDriver
{ {