forked from pterodactyl/panel
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSendPowerRequest.php
More file actions
42 lines (37 loc) · 1.02 KB
/
SendPowerRequest.php
File metadata and controls
42 lines (37 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
namespace Pterodactyl\Http\Requests\Api\Client\Servers;
use Pterodactyl\Models\Permission;
use Pterodactyl\Http\Requests\Api\Client\ClientApiRequest;
class SendPowerRequest extends ClientApiRequest
{
/**
* Determine if the user has permission to send a power command to a server.
*
* @return string
*/
public function permission(): string
{
switch ($this->input('signal')) {
case 'start':
return Permission::ACTION_CONTROL_START;
case 'stop':
return Permission::ACTION_CONTROL_STOP;
case 'restart':
return Permission::ACTION_CONTROL_RESTART;
case 'kill':
return Permission::ACTION_CONTROL_KILL;
}
return '__invalid';
}
/**
* Rules to validate this request against.
*
* @return array
*/
public function rules(): array
{
return [
'signal' => 'required|string|in:start,stop,restart,kill',
];
}
}