create(); [$user, $tenant] = createUserWithTenant(tenant: $tenant, role: 'owner'); $otherTenant = Tenant::factory()->create(); EntraGroupSyncRun::query()->create([ 'tenant_id' => $tenant->getKey(), 'selection_key' => 'groups-v1:all', 'slot_key' => 'slot-a', 'status' => EntraGroupSyncRun::STATUS_SUCCEEDED, ]); EntraGroupSyncRun::query()->create([ 'tenant_id' => $otherTenant->getKey(), 'selection_key' => 'groups-v1:all', 'slot_key' => 'slot-b', 'status' => EntraGroupSyncRun::STATUS_SUCCEEDED, ]); $this->actingAs($user) ->get(EntraGroupSyncRunResource::getUrl('index', tenant: $tenant)) ->assertOk() ->assertSee('slot-a') ->assertDontSee('slot-b'); }); test('entra group sync run view is forbidden cross-tenant (403)', function () { $tenantA = Tenant::factory()->create(); $tenantB = Tenant::factory()->create([ 'workspace_id' => $tenantA->workspace_id, ]); $runB = EntraGroupSyncRun::query()->create([ 'tenant_id' => $tenantB->getKey(), 'selection_key' => 'groups-v1:all', 'slot_key' => null, 'status' => EntraGroupSyncRun::STATUS_SUCCEEDED, ]); $user = User::factory()->create(); [$user, $tenantA] = createUserWithTenant(tenant: $tenantA, user: $user, role: 'owner'); $this->actingAs($user) ->get(EntraGroupSyncRunResource::getUrl('view', ['record' => $runB], tenant: $tenantA)) ->assertForbidden(); }); test('legacy sync runs list is read-only (no sync action)', function () { Queue::fake(); [$user, $tenant] = createUserWithTenant(role: 'owner'); $this->actingAs($user); $tenant->makeCurrent(); Filament::setTenant($tenant, true); $component = Livewire::test(ListEntraGroupSyncRuns::class)->instance(); $action = $component->getAction([['name' => 'sync_groups']]); expect($action)->toBeNull(); Queue::assertNothingPushed(); });