Implements Spec 076 enterprise remediation UX for tenant required permissions. Highlights - Above-the-fold overview (impact + counts) with missing-first experience - Feature-based grouping, filters/search, copy-to-clipboard for missing app/delegated permissions - Tenant-scoped deny-as-not-found semantics; DB-only viewing - Centralized badge semantics (no ad-hoc status mapping) Testing - Feature tests for default filters, grouping, copy output, and non-member 404 behavior. Integration - Adds deep links from verification checks to the Required permissions page. Co-authored-by: Ahmed Darrazi <ahmeddarrazi@MacBookPro.fritz.box> Reviewed-on: #92
34 lines
1.1 KiB
PHP
34 lines
1.1 KiB
PHP
<?php
|
|
|
|
use App\Models\Tenant;
|
|
use App\Services\Auth\CapabilityResolver;
|
|
use App\Support\Auth\Capabilities;
|
|
|
|
it('returns 404 for non-members accessing required permissions', function (): void {
|
|
[$user, $tenant] = createUserWithTenant(role: 'readonly');
|
|
|
|
$otherTenant = Tenant::factory()->create([
|
|
'workspace_id' => (int) $tenant->workspace_id,
|
|
]);
|
|
|
|
$this->actingAs($user)
|
|
->get("/admin/t/{$otherTenant->external_id}/required-permissions")
|
|
->assertNotFound();
|
|
});
|
|
|
|
it('returns 403 for members without tenant.view capability accessing required permissions', function (): void {
|
|
[$user, $tenant] = createUserWithTenant(role: 'readonly');
|
|
|
|
$this->mock(CapabilityResolver::class, function ($mock): void {
|
|
$mock->shouldReceive('isMember')
|
|
->andReturn(true);
|
|
|
|
$mock->shouldReceive('can')
|
|
->andReturnUsing(fn ($user, $tenant, $capability): bool => $capability !== Capabilities::TENANT_VIEW);
|
|
});
|
|
|
|
$this->actingAs($user)
|
|
->get("/admin/t/{$tenant->external_id}/required-permissions")
|
|
->assertForbidden();
|
|
});
|