Update interface to begin change to seperate account API keys and application keys
Main difference is permissions, cleaner UI for normal users, and account keys use permissions assigned to servers and subusers while application keys use R/W ACLs stored in the key table.
This commit is contained in:
parent
28ebd18f57
commit
f9fc3f4370
18 changed files with 312 additions and 298 deletions
|
@ -0,0 +1,58 @@
|
|||
<?php
|
||||
|
||||
namespace Pterodactyl\Console\Commands\Migration;
|
||||
|
||||
use Pterodactyl\Models\ApiKey;
|
||||
use Illuminate\Console\Command;
|
||||
use Pterodactyl\Contracts\Repository\ApiKeyRepositoryInterface;
|
||||
|
||||
class CleanOrphanedApiKeysCommand extends Command
|
||||
{
|
||||
/**
|
||||
* @var \Pterodactyl\Contracts\Repository\ApiKeyRepositoryInterface
|
||||
*/
|
||||
private $repository;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'p:migration:clean-orphaned-keys';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Cleans API keys from the database that are not assigned a specific role.';
|
||||
|
||||
/**
|
||||
* CleanOrphanedApiKeysCommand constructor.
|
||||
*
|
||||
* @param \Pterodactyl\Contracts\Repository\ApiKeyRepositoryInterface $repository
|
||||
*/
|
||||
public function __construct(ApiKeyRepositoryInterface $repository)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete all orphaned API keys from the database when upgrading from 0.6 to 0.7.
|
||||
*
|
||||
* @return null|void
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$count = $this->repository->findCountWhere([['key_type', '=', ApiKey::TYPE_NONE]]);
|
||||
$continue = $this->confirm(
|
||||
'This action will remove ' . $count . ' keys from the database. Are you sure you wish to continue?', false
|
||||
);
|
||||
|
||||
if (! $continue) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$this->info('Deleting keys...');
|
||||
$this->repository->deleteWhere([['key_type', '=', ApiKey::TYPE_NONE]]);
|
||||
$this->info('Keys were successfully deleted.');
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue