mirror of
https://github.com/MrUnknownDE/panel.git
synced 2026-04-14 20:33:45 +02:00
Update logic that handles creation of folders for a server
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Pterodactyl\Http\Requests\Api\Client\Servers\Files;
|
||||
|
||||
use Pterodactyl\Models\Server;
|
||||
use Pterodactyl\Http\Requests\Api\Client\ClientApiRequest;
|
||||
|
||||
class CreateFolderRequest extends ClientApiRequest
|
||||
{
|
||||
/**
|
||||
* Checks that the authenticated user is allowed to create files on the server.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return $this->user()->can('create-files', $this->getModel(Server::class));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'root' => 'sometimes|nullable|string',
|
||||
'name' => 'required|string',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -17,4 +17,14 @@ class ListFilesRequest extends ClientApiRequest
|
||||
{
|
||||
return $this->user()->can('list-files', $this->getModel(Server::class));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'directory' => 'sometimes|nullable|string',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user