mirror of
https://github.com/jez500/pricebuddy.git
synced 2026-11-24 19:58:13 +01:00
Redesign API key creation and enforce scoped abilities on the custom API routes. - ApiAbility enum and ability enforcement on the custom API routes - Redesigned API key creation: current user, all/custom permissions, and a dedicated one-time token page with a non-HTTPS clipboard fallback - Restrict custom keys to a known ability allowlist - Link global search results to the product view page rather than the edit page
28 lines
714 B
PHP
28 lines
714 B
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\ApiKeyResource\Pages;
|
|
|
|
use App\Filament\Resources\ApiKeyResource;
|
|
use Filament\Resources\Pages\Page;
|
|
|
|
class ApiKeyCreated extends Page
|
|
{
|
|
protected static string $resource = ApiKeyResource::class;
|
|
|
|
protected static string $view = 'filament.resources.api-key-resource.pages.api-key-created';
|
|
|
|
public ?string $plainTextToken = null;
|
|
|
|
public ?string $keyName = null;
|
|
|
|
public function mount(): void
|
|
{
|
|
$this->plainTextToken = session()->pull('api-key.plain_text');
|
|
$this->keyName = session()->pull('api-key.name');
|
|
|
|
if (blank($this->plainTextToken)) {
|
|
$this->redirect(ApiKeyResource::getUrl('index'));
|
|
}
|
|
}
|
|
}
|