## Summary - add the Spec 194 governance action catalog, friction classes, reason policies, and regression guards - align exception, review, evidence, finding, tenant, provider connection, and system run actions to the shared semantics model - add focused feature, RBAC, audit, unit, and browser coverage, including the tenant detail triage header consistency update ## Verification - ran the focused Spec 194 verification pack from the quickstart and task plan - ran targeted tenant triage coverage after the detail-header update - ran `cd apps/platform && ./vendor/bin/sail bin pint --dirty --format agent` ## Filament Notes - Filament v5 / Livewire v4 compliance preserved - provider registration remains in `apps/platform/bootstrap/providers.php` - globally searchable resources were not changed - destructive actions remain confirmation-gated and server-authorized - no new Filament assets were introduced; the existing `cd apps/platform && php artisan filament:assets` deploy step stays unchanged Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #229
66 lines
2.0 KiB
PHP
66 lines
2.0 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Support\Tenants\TenantPageCategory;
|
|
use App\Support\Workspaces\WorkspaceContext;
|
|
use Filament\Facades\Filament;
|
|
use Illuminate\Http\RedirectResponse;
|
|
use Illuminate\Http\Request;
|
|
|
|
final class ClearTenantContextController
|
|
{
|
|
public function __invoke(Request $request): RedirectResponse
|
|
{
|
|
Filament::setTenant(null, true);
|
|
|
|
$workspaceContext = app(WorkspaceContext::class);
|
|
|
|
$workspaceContext->clearRememberedTenantContext($request);
|
|
|
|
$previousUrl = url()->previous();
|
|
|
|
$previousHost = parse_url((string) $previousUrl, PHP_URL_HOST);
|
|
$previousPath = (string) (parse_url((string) $previousUrl, PHP_URL_PATH) ?? '');
|
|
|
|
if ($previousHost !== null && $previousHost !== $request->getHost()) {
|
|
return redirect()->route('admin.operations.index');
|
|
}
|
|
|
|
if ($this->isTenantScopedEvidencePath($previousPath)) {
|
|
return redirect()->route('admin.evidence.overview');
|
|
}
|
|
|
|
if (TenantPageCategory::fromPath($previousPath) === TenantPageCategory::TenantBound) {
|
|
$workspace = $workspaceContext->currentWorkspace($request);
|
|
|
|
if ($workspace !== null) {
|
|
return redirect()->route('admin.workspace.managed-tenants.index', ['workspace' => $workspace]);
|
|
}
|
|
|
|
return redirect()->route('admin.home');
|
|
}
|
|
|
|
if ($previousPath === '' || $previousPath === '/admin/clear-tenant-context') {
|
|
return redirect()->route('admin.operations.index');
|
|
}
|
|
|
|
return redirect()->to((string) $previousUrl);
|
|
}
|
|
|
|
private function isTenantScopedEvidencePath(string $previousPath): bool
|
|
{
|
|
if ($previousPath === '/admin/evidence') {
|
|
return true;
|
|
}
|
|
|
|
if (! str_starts_with($previousPath, '/admin/evidence/')) {
|
|
return false;
|
|
}
|
|
|
|
return ! str_starts_with($previousPath, '/admin/evidence/overview');
|
|
}
|
|
}
|