Finish building out schedule management functionality
This commit is contained in:
parent
4ac6507b69
commit
1e0d630e1f
16 changed files with 510 additions and 79 deletions
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace Pterodactyl\Http\Requests\Api\Client;
|
||||
|
||||
use Pterodactyl\Models\User;
|
||||
use Pterodactyl\Models\Server;
|
||||
use Pterodactyl\Contracts\Http\ClientPermissionsRequest;
|
||||
use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest;
|
||||
|
@ -20,7 +19,15 @@ class ClientApiRequest extends ApplicationApiRequest
|
|||
public function authorize(): bool
|
||||
{
|
||||
if ($this instanceof ClientPermissionsRequest || method_exists($this, 'permission')) {
|
||||
return $this->user()->can($this->permission(), $this->getModel(Server::class));
|
||||
$server = $this->route()->parameter('server');
|
||||
|
||||
if ($server instanceof Server) {
|
||||
return $this->user()->can($this->permission(), $server);
|
||||
}
|
||||
|
||||
// If there is no server available on the reqest, trigger a failure since
|
||||
// we expect there to be one at this point.
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue