2018-02-28 22:51:04 -06:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace Pterodactyl\Http\Requests\Api\Client\Servers;
|
|
|
|
|
|
2026-06-28 17:51:28 -04:00
|
|
|
use Pterodactyl\Models\Task;
|
2018-02-28 22:51:04 -06:00
|
|
|
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.
|
|
|
|
|
*/
|
2020-03-22 15:31:25 -07:00
|
|
|
public function permission(): string
|
2018-02-28 22:51:04 -06:00
|
|
|
{
|
2026-06-28 17:51:28 -04:00
|
|
|
return Task::permissionForAction(Task::ACTION_POWER, $this->input('signal')) ?? '__invalid';
|
2018-02-28 22:51:04 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2018-05-13 10:50:56 -04:00
|
|
|
* Rules to validate this request against.
|
2018-02-28 22:51:04 -06:00
|
|
|
*/
|
|
|
|
|
public function rules(): array
|
|
|
|
|
{
|
|
|
|
|
return [
|
2026-06-28 17:51:28 -04:00
|
|
|
'signal' => 'required|string|in:' . implode(',', Task::POWER_ACTIONS),
|
2018-02-28 22:51:04 -06:00
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
}
|