Push beginning of DB deletion stuff

This commit is contained in:
Dane Everitt 2018-08-25 14:43:21 -07:00
parent c28e9c1ab7
commit 9be2aa4ca9
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
9 changed files with 120 additions and 16 deletions

View file

@ -126,10 +126,6 @@ abstract class ApplicationApiRequest extends FormRequest
*
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
*/
/**
* @return bool
*/
protected function passesAuthorization()
{
// If we have already validated we do not need to call this function

View file

@ -0,0 +1,32 @@
<?php
namespace Pterodactyl\Http\Requests\Api\Client\Servers\Databases;
use Pterodactyl\Models\Server;
use Pterodactyl\Models\Database;
use Pterodactyl\Contracts\Http\ClientPermissionsRequest;
use Pterodactyl\Http\Requests\Api\Client\ClientApiRequest;
class DeleteDatabaseRequest extends ClientApiRequest implements ClientPermissionsRequest
{
/**
* @return string
*/
public function permission(): string
{
return 'delete-database';
}
/**
* Determine if the provided database even belongs to this server instance.
*
* @return bool
*/
public function resourceExists(): bool
{
$server = $this->getModel(Server::class);
$database = $this->getModel(Database::class);
return $database->server_id === $server->id;
}
}