Fix daemon key provider service

Handles missing keys if user is an admin or the server owner. Step in the right direction for #733 where all users have their own keys now. Still need to address admin status revocation in order to fully address that issue.
This commit is contained in:
Dane Everitt 2017-11-05 16:07:50 -06:00
parent 88562b5cd6
commit b1f6058e31
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
8 changed files with 159 additions and 53 deletions

View file

@ -25,7 +25,6 @@
namespace Pterodactyl\Services\DaemonKeys;
use Carbon\Carbon;
use Webmozart\Assert\Assert;
use Illuminate\Contracts\Config\Repository as ConfigRepository;
use Pterodactyl\Contracts\Repository\DaemonKeyRepositoryInterface;
@ -72,11 +71,8 @@ class DaemonKeyCreationService
*
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
*/
public function handle($server, $user)
public function handle(int $server, int $user)
{
Assert::integerish($server, 'First argument passed to handle must be an integer, received %s.');
Assert::integerish($user, 'Second argument passed to handle must be an integer, received %s.');
$secret = DaemonKeyRepositoryInterface::INTERNAL_KEY_IDENTIFIER . str_random(40);
$this->repository->withoutFresh()->create([