TenantAtlas/apps/platform/tests/Feature/ProviderConnections/ManageCapabilityEnforcementTest.php
Ahmed Darrazi 8cd125e398
Some checks failed
PR Fast Feedback / fast-feedback (pull_request) Failing after 1m45s
feat: implement environment CTA explicit filter contract
2026-05-16 13:49:05 +02:00

28 lines
865 B
PHP

<?php
declare(strict_types=1);
use App\Models\ProviderConnection;
it('returns 403 for tenant members without PROVIDER_MANAGE capability on create and edit', function (): void {
[$user, $tenant] = createUserWithTenant(role: 'readonly');
$connection = ProviderConnection::factory()->create([
'workspace_id' => (int) $tenant->workspace_id,
'managed_environment_id' => (int) $tenant->getKey(),
'provider' => 'microsoft',
]);
$this->actingAs($user)
->get('/admin/provider-connections/create?environment_id='.(int) $tenant->getKey())
->assertForbidden();
$this->actingAs($user)
->get('/admin/provider-connections/'.$connection->getKey())
->assertOk();
$this->actingAs($user)
->get('/admin/provider-connections/'.$connection->getKey().'/edit')
->assertForbidden();
});