mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-20 14:34:44 +02:00
Simplify and restrict api keys
This commit is contained in:
parent
05e9f12dc4
commit
99693367d3
@ -46,6 +46,7 @@ class ApiKeyResource extends Resource
|
|||||||
Forms\Components\Hidden::make('token')->default(encrypt(str_random(ApiKey::KEY_LENGTH))),
|
Forms\Components\Hidden::make('token')->default(encrypt(str_random(ApiKey::KEY_LENGTH))),
|
||||||
|
|
||||||
Forms\Components\Select::make('user_id')
|
Forms\Components\Select::make('user_id')
|
||||||
|
->hidden()
|
||||||
->searchable()
|
->searchable()
|
||||||
->preload()
|
->preload()
|
||||||
->relationship('user', 'username')
|
->relationship('user', 'username')
|
||||||
@ -66,6 +67,7 @@ class ApiKeyResource extends Resource
|
|||||||
->filter(fn ($value, $key) => $key <= ApiKey::TYPE_APPLICATION || $apiKey->key_type === $key)
|
->filter(fn ($value, $key) => $key <= ApiKey::TYPE_APPLICATION || $apiKey->key_type === $key)
|
||||||
->all();
|
->all();
|
||||||
})
|
})
|
||||||
|
->hidden()
|
||||||
->selectablePlaceholder(false)
|
->selectablePlaceholder(false)
|
||||||
->required()
|
->required()
|
||||||
->default(ApiKey::TYPE_APPLICATION),
|
->default(ApiKey::TYPE_APPLICATION),
|
||||||
|
@ -9,4 +9,6 @@ use Filament\Resources\Pages\CreateRecord;
|
|||||||
class CreateApiKey extends CreateRecord
|
class CreateApiKey extends CreateRecord
|
||||||
{
|
{
|
||||||
protected static string $resource = ApiKeyResource::class;
|
protected static string $resource = ApiKeyResource::class;
|
||||||
|
|
||||||
|
protected ?string $heading = 'Create Application API Key';
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user