mirror of
https://github.com/MrUnknownDE/panel.git
synced 2026-04-18 22:33:44 +02:00
Add client API
This commit is contained in:
@@ -24,7 +24,7 @@ class SendCommandRequest extends GetServerRequest
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'command' => 'string|min:1',
|
||||
'command' => 'required|string|min:1',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
31
app/Http/Requests/Api/Client/Servers/SendPowerRequest.php
Normal file
31
app/Http/Requests/Api/Client/Servers/SendPowerRequest.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Pterodactyl\Http\Requests\Api\Client\Servers;
|
||||
|
||||
use Pterodactyl\Models\Server;
|
||||
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 bool
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return $this->user()->can('power-' . $this->input('signal', '_undefined'), $this->getModel(Server::class));
|
||||
}
|
||||
|
||||
/**
|
||||
* Rules to validate this request aganist.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'signal' => 'required|string|in:start,stop,restart,kill',
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user