Upgrade to Laravel 9 (#4413)
Co-authored-by: DaneEveritt <dane@daneeveritt.com>
This commit is contained in:
parent
95e15d2c8a
commit
cbcf62086f
573 changed files with 4387 additions and 9411 deletions
|
@ -7,13 +7,7 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest;
|
|||
|
||||
class DeleteAllocationRequest extends ApplicationApiRequest
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $resource = AdminAcl::RESOURCE_ALLOCATIONS;
|
||||
protected ?string $resource = AdminAcl::RESOURCE_ALLOCATIONS;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $permission = AdminAcl::WRITE;
|
||||
protected int $permission = AdminAcl::WRITE;
|
||||
}
|
||||
|
|
|
@ -7,13 +7,7 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest;
|
|||
|
||||
class GetAllocationsRequest extends ApplicationApiRequest
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $resource = AdminAcl::RESOURCE_ALLOCATIONS;
|
||||
protected ?string $resource = AdminAcl::RESOURCE_ALLOCATIONS;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $permission = AdminAcl::READ;
|
||||
protected int $permission = AdminAcl::READ;
|
||||
}
|
||||
|
|
|
@ -7,15 +7,9 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest;
|
|||
|
||||
class StoreAllocationRequest extends ApplicationApiRequest
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $resource = AdminAcl::RESOURCE_ALLOCATIONS;
|
||||
protected ?string $resource = AdminAcl::RESOURCE_ALLOCATIONS;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $permission = AdminAcl::WRITE;
|
||||
protected int $permission = AdminAcl::WRITE;
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
|
@ -27,10 +21,7 @@ class StoreAllocationRequest extends ApplicationApiRequest
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function validated()
|
||||
public function validated($key = null, $default = null): array
|
||||
{
|
||||
$data = parent::validated();
|
||||
|
||||
|
|
|
@ -16,18 +16,14 @@ abstract class ApplicationApiRequest extends FormRequest
|
|||
/**
|
||||
* The resource that should be checked when performing the authorization
|
||||
* function for this request.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
protected $resource;
|
||||
protected ?string $resource;
|
||||
|
||||
/**
|
||||
* The permission level that a given API key should have for accessing
|
||||
* the defined $resource during the request cycle.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $permission = AdminAcl::NONE;
|
||||
protected int $permission = AdminAcl::NONE;
|
||||
|
||||
/**
|
||||
* Determine if the current user is authorized to perform
|
||||
|
@ -80,7 +76,7 @@ abstract class ApplicationApiRequest extends FormRequest
|
|||
* @param class-string<T> $expect
|
||||
*
|
||||
* @return T
|
||||
* @noinspection PhpUndefinedClassInspection
|
||||
*
|
||||
* @noinspection PhpDocSignatureInspection
|
||||
*/
|
||||
public function parameter(string $key, string $expect)
|
||||
|
|
|
@ -7,13 +7,7 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest;
|
|||
|
||||
class DeleteLocationRequest extends ApplicationApiRequest
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $resource = AdminAcl::RESOURCE_LOCATIONS;
|
||||
protected ?string $resource = AdminAcl::RESOURCE_LOCATIONS;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $permission = AdminAcl::WRITE;
|
||||
protected int $permission = AdminAcl::WRITE;
|
||||
}
|
||||
|
|
|
@ -7,13 +7,7 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest;
|
|||
|
||||
class GetLocationsRequest extends ApplicationApiRequest
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $resource = AdminAcl::RESOURCE_LOCATIONS;
|
||||
protected ?string $resource = AdminAcl::RESOURCE_LOCATIONS;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $permission = AdminAcl::READ;
|
||||
protected int $permission = AdminAcl::READ;
|
||||
}
|
||||
|
|
|
@ -8,15 +8,9 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest;
|
|||
|
||||
class StoreLocationRequest extends ApplicationApiRequest
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $resource = AdminAcl::RESOURCE_LOCATIONS;
|
||||
protected ?string $resource = AdminAcl::RESOURCE_LOCATIONS;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $permission = AdminAcl::WRITE;
|
||||
protected int $permission = AdminAcl::WRITE;
|
||||
|
||||
/**
|
||||
* Rules to validate the request against.
|
||||
|
@ -31,10 +25,8 @@ class StoreLocationRequest extends ApplicationApiRequest
|
|||
|
||||
/**
|
||||
* Rename fields to be more clear in error messages.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function attributes()
|
||||
public function attributes(): array
|
||||
{
|
||||
return [
|
||||
'long' => 'Location Description',
|
||||
|
|
|
@ -7,13 +7,7 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest;
|
|||
|
||||
class GetEggRequest extends ApplicationApiRequest
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $resource = AdminAcl::RESOURCE_EGGS;
|
||||
protected ?string $resource = AdminAcl::RESOURCE_EGGS;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $permission = AdminAcl::READ;
|
||||
protected int $permission = AdminAcl::READ;
|
||||
}
|
||||
|
|
|
@ -7,13 +7,7 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest;
|
|||
|
||||
class GetEggsRequest extends ApplicationApiRequest
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $resource = AdminAcl::RESOURCE_EGGS;
|
||||
protected ?string $resource = AdminAcl::RESOURCE_EGGS;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $permission = AdminAcl::READ;
|
||||
protected int $permission = AdminAcl::READ;
|
||||
}
|
||||
|
|
|
@ -7,13 +7,7 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest;
|
|||
|
||||
class GetNestsRequest extends ApplicationApiRequest
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $resource = AdminAcl::RESOURCE_NESTS;
|
||||
protected ?string $resource = AdminAcl::RESOURCE_NESTS;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $permission = AdminAcl::READ;
|
||||
protected int $permission = AdminAcl::READ;
|
||||
}
|
||||
|
|
|
@ -7,13 +7,7 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest;
|
|||
|
||||
class DeleteNodeRequest extends ApplicationApiRequest
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $resource = AdminAcl::RESOURCE_NODES;
|
||||
protected ?string $resource = AdminAcl::RESOURCE_NODES;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $permission = AdminAcl::WRITE;
|
||||
protected int $permission = AdminAcl::WRITE;
|
||||
}
|
||||
|
|
|
@ -4,9 +4,6 @@ namespace Pterodactyl\Http\Requests\Api\Application\Nodes;
|
|||
|
||||
class GetDeployableNodesRequest extends GetNodesRequest
|
||||
{
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
|
|
|
@ -7,13 +7,7 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest;
|
|||
|
||||
class GetNodesRequest extends ApplicationApiRequest
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $resource = AdminAcl::RESOURCE_NODES;
|
||||
protected ?string $resource = AdminAcl::RESOURCE_NODES;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $permission = AdminAcl::READ;
|
||||
protected int $permission = AdminAcl::READ;
|
||||
}
|
||||
|
|
|
@ -8,15 +8,9 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest;
|
|||
|
||||
class StoreNodeRequest extends ApplicationApiRequest
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $resource = AdminAcl::RESOURCE_NODES;
|
||||
protected ?string $resource = AdminAcl::RESOURCE_NODES;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $permission = AdminAcl::WRITE;
|
||||
protected int $permission = AdminAcl::WRITE;
|
||||
|
||||
/**
|
||||
* Validation rules to apply to this request.
|
||||
|
@ -47,10 +41,8 @@ class StoreNodeRequest extends ApplicationApiRequest
|
|||
|
||||
/**
|
||||
* Fields to rename for clarity in the API response.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function attributes()
|
||||
public function attributes(): array
|
||||
{
|
||||
return [
|
||||
'daemon_base' => 'Daemon Base Path',
|
||||
|
@ -63,10 +55,8 @@ class StoreNodeRequest extends ApplicationApiRequest
|
|||
/**
|
||||
* Change the formatting of some data keys in the validated response data
|
||||
* to match what the application expects in the services.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function validated()
|
||||
public function validated($key = null, $default = null): array
|
||||
{
|
||||
$response = parent::validated();
|
||||
$response['daemonListen'] = $response['daemon_listen'];
|
||||
|
|
|
@ -7,13 +7,7 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest;
|
|||
|
||||
class GetServerDatabaseRequest extends ApplicationApiRequest
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $resource = AdminAcl::RESOURCE_SERVER_DATABASES;
|
||||
protected ?string $resource = AdminAcl::RESOURCE_SERVER_DATABASES;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $permission = AdminAcl::READ;
|
||||
protected int $permission = AdminAcl::READ;
|
||||
}
|
||||
|
|
|
@ -7,13 +7,7 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest;
|
|||
|
||||
class GetServerDatabasesRequest extends ApplicationApiRequest
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $resource = AdminAcl::RESOURCE_SERVER_DATABASES;
|
||||
protected ?string $resource = AdminAcl::RESOURCE_SERVER_DATABASES;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $permission = AdminAcl::READ;
|
||||
protected int $permission = AdminAcl::READ;
|
||||
}
|
||||
|
|
|
@ -6,8 +6,5 @@ use Pterodactyl\Services\Acl\Api\AdminAcl;
|
|||
|
||||
class ServerDatabaseWriteRequest extends GetServerDatabasesRequest
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $permission = AdminAcl::WRITE;
|
||||
protected int $permission = AdminAcl::WRITE;
|
||||
}
|
||||
|
|
|
@ -12,15 +12,9 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest;
|
|||
|
||||
class StoreServerDatabaseRequest extends ApplicationApiRequest
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $resource = AdminAcl::RESOURCE_SERVER_DATABASES;
|
||||
protected ?string $resource = AdminAcl::RESOURCE_SERVER_DATABASES;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $permission = AdminAcl::WRITE;
|
||||
protected int $permission = AdminAcl::WRITE;
|
||||
|
||||
/**
|
||||
* Validation rules for database creation.
|
||||
|
@ -46,10 +40,8 @@ class StoreServerDatabaseRequest extends ApplicationApiRequest
|
|||
|
||||
/**
|
||||
* Return data formatted in the correct format for the service to consume.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function validated()
|
||||
public function validated($key = null, $default = null): array
|
||||
{
|
||||
return [
|
||||
'database' => $this->input('database'),
|
||||
|
@ -60,10 +52,8 @@ class StoreServerDatabaseRequest extends ApplicationApiRequest
|
|||
|
||||
/**
|
||||
* Format error messages in a more understandable format for API output.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function attributes()
|
||||
public function attributes(): array
|
||||
{
|
||||
return [
|
||||
'host' => 'Database Host Server ID',
|
||||
|
|
|
@ -7,13 +7,7 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest;
|
|||
|
||||
class GetExternalServerRequest extends ApplicationApiRequest
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $resource = AdminAcl::RESOURCE_SERVERS;
|
||||
protected ?string $resource = AdminAcl::RESOURCE_SERVERS;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $permission = AdminAcl::READ;
|
||||
protected int $permission = AdminAcl::READ;
|
||||
}
|
||||
|
|
|
@ -7,13 +7,7 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest;
|
|||
|
||||
class GetServerRequest extends ApplicationApiRequest
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $resource = AdminAcl::RESOURCE_SERVERS;
|
||||
protected ?string $resource = AdminAcl::RESOURCE_SERVERS;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $permission = AdminAcl::READ;
|
||||
protected int $permission = AdminAcl::READ;
|
||||
}
|
||||
|
|
|
@ -7,13 +7,7 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest;
|
|||
|
||||
class ServerWriteRequest extends ApplicationApiRequest
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $resource = AdminAcl::RESOURCE_SERVERS;
|
||||
protected ?string $resource = AdminAcl::RESOURCE_SERVERS;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $permission = AdminAcl::WRITE;
|
||||
protected int $permission = AdminAcl::WRITE;
|
||||
}
|
||||
|
|
|
@ -11,15 +11,9 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest;
|
|||
|
||||
class StoreServerRequest extends ApplicationApiRequest
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $resource = AdminAcl::RESOURCE_SERVERS;
|
||||
protected ?string $resource = AdminAcl::RESOURCE_SERVERS;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $permission = AdminAcl::WRITE;
|
||||
protected int $permission = AdminAcl::WRITE;
|
||||
|
||||
/**
|
||||
* Rules to be applied to this request.
|
||||
|
@ -73,10 +67,8 @@ class StoreServerRequest extends ApplicationApiRequest
|
|||
|
||||
/**
|
||||
* Normalize the data into a format that can be consumed by the service.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function validated()
|
||||
public function validated($key = null, $default = null): array
|
||||
{
|
||||
$data = parent::validated();
|
||||
|
||||
|
@ -119,7 +111,7 @@ class StoreServerRequest extends ApplicationApiRequest
|
|||
$query->whereNull('server_id');
|
||||
}),
|
||||
], function ($input) {
|
||||
return !($input->deploy);
|
||||
return !$input->deploy;
|
||||
});
|
||||
|
||||
$validator->sometimes('allocation.additional.*', [
|
||||
|
@ -128,7 +120,7 @@ class StoreServerRequest extends ApplicationApiRequest
|
|||
$query->whereNull('server_id');
|
||||
}),
|
||||
], function ($input) {
|
||||
return !($input->deploy);
|
||||
return !$input->deploy;
|
||||
});
|
||||
|
||||
$validator->sometimes('deploy.locations', 'present', function ($input) {
|
||||
|
@ -142,10 +134,8 @@ class StoreServerRequest extends ApplicationApiRequest
|
|||
|
||||
/**
|
||||
* Return a deployment object that can be passed to the server creation service.
|
||||
*
|
||||
* @return \Pterodactyl\Models\Objects\DeploymentObject|null
|
||||
*/
|
||||
public function getDeploymentObject()
|
||||
public function getDeploymentObject(): ?DeploymentObject
|
||||
{
|
||||
if (is_null($this->input('deploy'))) {
|
||||
return null;
|
||||
|
|
|
@ -51,10 +51,8 @@ class UpdateServerBuildConfigurationRequest extends ServerWriteRequest
|
|||
|
||||
/**
|
||||
* Convert the allocation field into the expected format for the service handler.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function validated()
|
||||
public function validated($key = null, $default = null): array
|
||||
{
|
||||
$data = parent::validated();
|
||||
|
||||
|
@ -78,10 +76,8 @@ class UpdateServerBuildConfigurationRequest extends ServerWriteRequest
|
|||
|
||||
/**
|
||||
* Custom attributes to use in error message responses.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function attributes()
|
||||
public function attributes(): array
|
||||
{
|
||||
return [
|
||||
'add_allocations' => 'allocations to add',
|
||||
|
@ -99,11 +95,9 @@ class UpdateServerBuildConfigurationRequest extends ServerWriteRequest
|
|||
* compatability with the old API endpoint while also supporting a more correct API
|
||||
* call.
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @see https://github.com/pterodactyl/panel/issues/1500
|
||||
*/
|
||||
protected function requiredToOptional(string $field, array $rules, bool $limits = false)
|
||||
protected function requiredToOptional(string $field, array $rules, bool $limits = false): array
|
||||
{
|
||||
if (!in_array('required', $rules)) {
|
||||
return $rules;
|
||||
|
|
|
@ -25,7 +25,7 @@ class UpdateServerDetailsRequest extends ServerWriteRequest
|
|||
* Convert the posted data into the correct format that is expected
|
||||
* by the application.
|
||||
*/
|
||||
public function validated(): array
|
||||
public function validated($key = null, $default = null): array
|
||||
{
|
||||
return [
|
||||
'external_id' => $this->input('external_id'),
|
||||
|
@ -36,7 +36,7 @@ class UpdateServerDetailsRequest extends ServerWriteRequest
|
|||
}
|
||||
|
||||
/**
|
||||
* Rename some of the attributes in error messages to clarify the field
|
||||
* Rename some attributes in error messages to clarify the field
|
||||
* being discussed.
|
||||
*/
|
||||
public function attributes(): array
|
||||
|
|
|
@ -8,15 +8,9 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest;
|
|||
|
||||
class UpdateServerStartupRequest extends ApplicationApiRequest
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $resource = AdminAcl::RESOURCE_SERVERS;
|
||||
protected ?string $resource = AdminAcl::RESOURCE_SERVERS;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $permission = AdminAcl::WRITE;
|
||||
protected int $permission = AdminAcl::WRITE;
|
||||
|
||||
/**
|
||||
* Validation rules to run the input against.
|
||||
|
@ -36,10 +30,8 @@ class UpdateServerStartupRequest extends ApplicationApiRequest
|
|||
|
||||
/**
|
||||
* Return the validated data in a format that is expected by the service.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function validated()
|
||||
public function validated($key = null, $default = null): array
|
||||
{
|
||||
$data = parent::validated();
|
||||
|
||||
|
|
|
@ -7,13 +7,7 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest;
|
|||
|
||||
class DeleteUserRequest extends ApplicationApiRequest
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $resource = AdminAcl::RESOURCE_USERS;
|
||||
protected ?string $resource = AdminAcl::RESOURCE_USERS;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $permission = AdminAcl::WRITE;
|
||||
protected int $permission = AdminAcl::WRITE;
|
||||
}
|
||||
|
|
|
@ -7,13 +7,7 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest;
|
|||
|
||||
class GetExternalUserRequest extends ApplicationApiRequest
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $resource = AdminAcl::RESOURCE_USERS;
|
||||
protected ?string $resource = AdminAcl::RESOURCE_USERS;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $permission = AdminAcl::READ;
|
||||
protected int $permission = AdminAcl::READ;
|
||||
}
|
||||
|
|
|
@ -7,13 +7,7 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest;
|
|||
|
||||
class GetUsersRequest extends ApplicationApiRequest
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $resource = Acl::RESOURCE_USERS;
|
||||
protected ?string $resource = Acl::RESOURCE_USERS;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $permission = Acl::READ;
|
||||
protected int $permission = Acl::READ;
|
||||
}
|
||||
|
|
|
@ -8,15 +8,9 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest;
|
|||
|
||||
class StoreUserRequest extends ApplicationApiRequest
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $resource = AdminAcl::RESOURCE_USERS;
|
||||
protected ?string $resource = AdminAcl::RESOURCE_USERS;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $permission = AdminAcl::WRITE;
|
||||
protected int $permission = AdminAcl::WRITE;
|
||||
|
||||
/**
|
||||
* Return the validation rules for this request.
|
||||
|
@ -40,10 +34,7 @@ class StoreUserRequest extends ApplicationApiRequest
|
|||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function validated()
|
||||
public function validated($key = null, $default = null): array
|
||||
{
|
||||
$data = parent::validated();
|
||||
|
||||
|
@ -57,10 +48,8 @@ class StoreUserRequest extends ApplicationApiRequest
|
|||
|
||||
/**
|
||||
* Rename some fields to be more user friendly.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function attributes()
|
||||
public function attributes(): array
|
||||
{
|
||||
return [
|
||||
'external_id' => 'Third Party Identifier',
|
||||
|
|
|
@ -7,10 +7,7 @@ use Pterodactyl\Http\Requests\Api\Client\ClientApiRequest;
|
|||
|
||||
class StoreBackupRequest extends ClientApiRequest
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function permission()
|
||||
public function permission(): string
|
||||
{
|
||||
return Permission::ACTION_BACKUP_CREATE;
|
||||
}
|
||||
|
|
|
@ -43,10 +43,7 @@ class StoreDatabaseRequest extends ClientApiRequest implements ClientPermissions
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function messages()
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'database.unique' => 'The database name you have selected is already in use by this server.',
|
||||
|
|
|
@ -9,7 +9,7 @@ class ListFilesRequest extends ClientApiRequest
|
|||
{
|
||||
/**
|
||||
* Check that the user making this request to the API is authorized to list all
|
||||
* of the files that exist for a given server.
|
||||
* the files that exist for a given server.
|
||||
*/
|
||||
public function permission(): string
|
||||
{
|
||||
|
|
|
@ -13,9 +13,6 @@ class PullFileRequest extends ClientApiRequest implements ClientPermissionsReque
|
|||
return Permission::ACTION_FILE_CREATE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
|
|
|
@ -7,10 +7,7 @@ use Pterodactyl\Http\Requests\Api\Client\ClientApiRequest;
|
|||
|
||||
class UploadFileRequest extends ClientApiRequest
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function permission()
|
||||
public function permission(): string
|
||||
{
|
||||
return Permission::ACTION_FILE_CREATE;
|
||||
}
|
||||
|
|
|
@ -7,10 +7,7 @@ use Pterodactyl\Http\Requests\Api\Client\ClientApiRequest;
|
|||
|
||||
class ReinstallServerRequest extends ClientApiRequest
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function permission()
|
||||
public function permission(): string
|
||||
{
|
||||
return Permission::ACTION_SETTINGS_REINSTALL;
|
||||
}
|
||||
|
|
|
@ -16,9 +16,6 @@ class SetDockerImageRequest extends ClientApiRequest implements ClientPermission
|
|||
return Permission::ACTION_STARTUP_DOCKER_IMAGE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array[]
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
/** @var \Pterodactyl\Models\Server $server */
|
||||
|
|
|
@ -7,10 +7,7 @@ use Pterodactyl\Http\Requests\Api\Client\ClientApiRequest;
|
|||
|
||||
class GetStartupRequest extends ClientApiRequest
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function permission()
|
||||
public function permission(): string
|
||||
{
|
||||
return Permission::ACTION_STARTUP_READ;
|
||||
}
|
||||
|
|
|
@ -7,18 +7,13 @@ use Pterodactyl\Http\Requests\Api\Client\ClientApiRequest;
|
|||
|
||||
class UpdateStartupVariableRequest extends ClientApiRequest
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function permission()
|
||||
public function permission(): string
|
||||
{
|
||||
return Permission::ACTION_STARTUP_UPDATE;
|
||||
}
|
||||
|
||||
/**
|
||||
* The actual validation of the variable's value will happen inside the controller.
|
||||
*
|
||||
* @return array|string[]
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
|
|
|
@ -6,10 +6,7 @@ use Pterodactyl\Models\Permission;
|
|||
|
||||
class DeleteSubuserRequest extends SubuserRequest
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function permission()
|
||||
public function permission(): string
|
||||
{
|
||||
return Permission::ACTION_USER_DELETE;
|
||||
}
|
||||
|
|
|
@ -6,10 +6,7 @@ use Pterodactyl\Models\Permission;
|
|||
|
||||
class StoreSubuserRequest extends SubuserRequest
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function permission()
|
||||
public function permission(): string
|
||||
{
|
||||
return Permission::ACTION_USER_CREATE;
|
||||
}
|
||||
|
|
|
@ -4,16 +4,14 @@ namespace Pterodactyl\Http\Requests\Api\Client\Servers\Subusers;
|
|||
|
||||
use Illuminate\Http\Request;
|
||||
use Pterodactyl\Models\User;
|
||||
use Pterodactyl\Models\Subuser;
|
||||
use Pterodactyl\Exceptions\Http\HttpForbiddenException;
|
||||
use Pterodactyl\Http\Requests\Api\Client\ClientApiRequest;
|
||||
use Pterodactyl\Services\Servers\GetUserPermissionsService;
|
||||
|
||||
abstract class SubuserRequest extends ClientApiRequest
|
||||
{
|
||||
/**
|
||||
* @var \Pterodactyl\Models\Subuser|null
|
||||
*/
|
||||
protected $model;
|
||||
protected ?Subuser $model;
|
||||
|
||||
/**
|
||||
* Authorize the request and ensure that a user is not trying to modify themselves.
|
||||
|
|
|
@ -6,10 +6,7 @@ use Pterodactyl\Models\Permission;
|
|||
|
||||
class UpdateSubuserRequest extends SubuserRequest
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function permission()
|
||||
public function permission(): string
|
||||
{
|
||||
return Permission::ACTION_USER_UPDATE;
|
||||
}
|
||||
|
|
|
@ -27,9 +27,7 @@ class ActivityEventRequest extends FormRequest
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns all of the unique server UUIDs that were recieved in this request.
|
||||
*
|
||||
* @return string[]
|
||||
* Returns all the unique server UUIDs that were received in this request.
|
||||
*/
|
||||
public function servers(): array
|
||||
{
|
||||
|
@ -37,9 +35,7 @@ class ActivityEventRequest extends FormRequest
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns all of the unique user UUIDs that were submitted in this request.
|
||||
*
|
||||
* @return string[]
|
||||
* Returns all the unique user UUIDs that were submitted in this request.
|
||||
*/
|
||||
public function users(): array
|
||||
{
|
||||
|
|
|
@ -6,18 +6,12 @@ use Illuminate\Foundation\Http\FormRequest;
|
|||
|
||||
class AuthenticateWebsocketDetailsRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'server_uuid' => 'required|string',
|
||||
|
|
|
@ -6,18 +6,12 @@ use Illuminate\Foundation\Http\FormRequest;
|
|||
|
||||
class InstallationDataRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'successful' => 'present|boolean',
|
||||
|
|
|
@ -6,10 +6,7 @@ use Illuminate\Foundation\Http\FormRequest;
|
|||
|
||||
class ReportBackupCompleteRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public function rules()
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'successful' => 'required|boolean',
|
||||
|
|
|
@ -8,20 +8,16 @@ class SftpAuthenticationFormRequest extends FormRequest
|
|||
{
|
||||
/**
|
||||
* Authenticate the request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Rules to apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'type' => ['nullable', 'in:password,public_key'],
|
||||
|
@ -33,10 +29,8 @@ class SftpAuthenticationFormRequest extends FormRequest
|
|||
/**
|
||||
* Return only the fields that we are interested in from the request.
|
||||
* This will include empty fields as a null value.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function normalize()
|
||||
public function normalize(): array
|
||||
{
|
||||
return $this->only(
|
||||
array_keys($this->rules())
|
||||
|
|
Reference in a new issue