## Summary - retire remaining legacy tenant-panel runtime assumptions in the Filament admin runtime and route resolution paths - centralize canonical admin environment context handling for shared surfaces instead of relying on deprecated `tenant` panel behavior - harden guard coverage so legacy `/admin/t` and `/admin/tenants` route families cannot regress - update scoped navigation, drillthrough, reference-link, and global-search tests to use the admin panel environment runtime - add the Spec 304 package under `specs/304-tenant-panel-dead-code-retirement/` and document the rollout in the product ledger ## Test Coverage Updated - `AdminSharedSurfacePanelParityTest` - `NoActiveTenantResourceRoutesTest` - `NoLegacyTenantPanelRuntimeTest` - `AdminTenantResolverGuardTest` - `PolicyVersionResolvedReferenceLinksTest` - `EntraGroupGlobalSearchScopeTest` - `OperationsDashboardDrillthroughTest` ## Runtime Notes - remains compliant with Filament v5 on Livewire v4 - no provider registration changes; provider registration location remains `apps/platform/bootstrap/providers.php` - no new globally searchable resource was introduced; existing scoped search assertions were updated only - no destructive actions were added or changed - no asset registration changes; deploy posture for `cd apps/platform && php artisan filament:assets` is unchanged ## Validation - updated tests and docs/spec artifacts were committed in this branch - tests were not re-run in this turn Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #359
54 lines
1.7 KiB
PHP
54 lines
1.7 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Filament\Resources\EntraGroupResource;
|
|
use App\Filament\Resources\PolicyVersionResource;
|
|
use App\Models\EntraGroup;
|
|
use App\Models\Policy;
|
|
use App\Models\PolicyVersion;
|
|
use App\Support\Workspaces\WorkspaceContext;
|
|
use Filament\Facades\Filament;
|
|
|
|
it('renders canonical group links for resolved assignment targets', function (): void {
|
|
[$user, $tenant] = createUserWithTenant(role: 'owner');
|
|
$this->actingAs($user);
|
|
Filament::setCurrentPanel('admin');
|
|
Filament::setTenant($tenant, true);
|
|
Filament::bootCurrentPanel();
|
|
|
|
$groupId = '33333333-4444-5555-6666-777777777777';
|
|
|
|
$group = EntraGroup::factory()->for($tenant)->create([
|
|
'entra_id' => strtolower($groupId),
|
|
'display_name' => 'Scoped group',
|
|
]);
|
|
|
|
$policy = Policy::factory()->for($tenant)->create();
|
|
|
|
$version = PolicyVersion::factory()->for($tenant)->create([
|
|
'policy_id' => (int) $policy->getKey(),
|
|
'assignments' => [
|
|
[
|
|
'intent' => 'apply',
|
|
'target' => [
|
|
'@odata.type' => '#microsoft.graph.groupAssignmentTarget',
|
|
'groupId' => $groupId,
|
|
],
|
|
],
|
|
],
|
|
]);
|
|
|
|
$groupUrl = EntraGroupResource::getUrl('view', ['record' => $group], panel: 'admin', tenant: $tenant);
|
|
|
|
expect($groupUrl)
|
|
->not->toContain('/admin/tenants')
|
|
->not->toContain('/admin/t/');
|
|
|
|
$this->withSession([WorkspaceContext::SESSION_KEY => (int) $tenant->workspace_id])
|
|
->get(PolicyVersionResource::getUrl('view', ['record' => $version], panel: 'admin', tenant: $tenant))
|
|
->assertOk()
|
|
->assertSee($groupUrl, false)
|
|
->assertSee('Scoped group');
|
|
});
|