mirror of
				https://github.com/pelican-dev/panel.git
				synced 2025-11-04 03:36:53 +01:00 
			
		
		
		
	* Install Pest * Don’t use bootstrap file anymore * Fix comment * Think this is needed * Reset this * Switch dataproviders to attributes * Fix these * Support in memory databases * Fix this migration * Switch this back for now * Add missing import * Truncate and reseed database * These are replaced now * Switch ci to use pest
		
			
				
	
	
		
			31 lines
		
	
	
		
			894 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			31 lines
		
	
	
		
			894 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
 | 
						|
namespace App\Http\Requests\Api\Client;
 | 
						|
 | 
						|
use App\Models\Server;
 | 
						|
use App\Contracts\Http\ClientPermissionsRequest;
 | 
						|
use App\Http\Requests\Api\Application\ApplicationApiRequest;
 | 
						|
 | 
						|
class ClientApiRequest extends ApplicationApiRequest
 | 
						|
{
 | 
						|
    /**
 | 
						|
     * Determine if the current user is authorized to perform the requested action against the API.
 | 
						|
     */
 | 
						|
    public function authorize(): bool
 | 
						|
    {
 | 
						|
        if ($this instanceof ClientPermissionsRequest || method_exists($this, 'permission')) {
 | 
						|
            $server = $this->route()->parameter('server');
 | 
						|
 | 
						|
            if ($server instanceof Server) {
 | 
						|
                return $this->user()->can($this->permission(), $server);
 | 
						|
            }
 | 
						|
 | 
						|
            // If there is no server available on the request, trigger a failure since
 | 
						|
            // we expect there to be one at this point.
 | 
						|
            return false;
 | 
						|
        }
 | 
						|
 | 
						|
        return true;
 | 
						|
    }
 | 
						|
}
 |