Add database password rotation to view

This commit is contained in:
Dane Everitt 2019-07-27 15:17:50 -07:00
parent f6ee885f26
commit 48c39abfcb
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
11 changed files with 178 additions and 6 deletions

View file

@ -6,6 +6,9 @@ use Pterodactyl\Models\Server;
use Pterodactyl\Contracts\Http\ClientPermissionsRequest;
use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest;
/**
* @method \Pterodactyl\Models\User user($guard = null)
*/
abstract class ClientApiRequest extends ApplicationApiRequest
{
/**

View file

@ -0,0 +1,19 @@
<?php
namespace Pterodactyl\Http\Requests\Api\Client\Servers\Databases;
use Pterodactyl\Models\Server;
use Pterodactyl\Http\Requests\Api\Client\ClientApiRequest;
class RotatePasswordRequest extends ClientApiRequest
{
/**
* Check that the user has permission to rotate the password.
*
* @return bool
*/
public function authorize(): bool
{
return $this->user()->can('reset-db-password', $this->getModel(Server::class));
}
}