mirror of
				https://github.com/pelican-dev/panel.git
				synced 2025-11-04 04:06:51 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			32 lines
		
	
	
		
			726 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
		
			726 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?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('control.' . $this->input('signal', ''), $this->getModel(Server::class));
 | 
						|
    }
 | 
						|
 | 
						|
    /**
 | 
						|
     * Rules to validate this request against.
 | 
						|
     *
 | 
						|
     * @return array
 | 
						|
     */
 | 
						|
    public function rules(): array
 | 
						|
    {
 | 
						|
        return [
 | 
						|
            'signal' => 'required|string|in:start,stop,restart,kill',
 | 
						|
        ];
 | 
						|
    }
 | 
						|
}
 |