Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pterodactyl
GitHub Repository: pterodactyl/panel
Path: blob/1.0-develop/app/Http/Requests/Api/Client/Servers/Files/WriteFileContentRequest.php
10278 views
1
<?php
2
3
namespace Pterodactyl\Http\Requests\Api\Client\Servers\Files;
4
5
use Pterodactyl\Models\Permission;
6
use Pterodactyl\Contracts\Http\ClientPermissionsRequest;
7
use Pterodactyl\Http\Requests\Api\Client\ClientApiRequest;
8
9
class WriteFileContentRequest extends ClientApiRequest implements ClientPermissionsRequest
10
{
11
/**
12
* Returns the permissions string indicating which permission should be used to
13
* validate that the authenticated user has permission to perform this action aganist
14
* the given resource (server).
15
*/
16
public function permission(): string
17
{
18
return Permission::ACTION_FILE_CREATE;
19
}
20
21
/**
22
* There is no rule here for the file contents since we just use the body content
23
* on the request to set the file contents. If nothing is passed that is fine since
24
* it just means we want to set the file to be empty.
25
*/
26
public function rules(): array
27
{
28
return [
29
'file' => 'required|string',
30
];
31
}
32
}
33
34