fix(offers): preserve description in authorised investment context

This commit is contained in:
2026-11-14 18:39:25 +02:00
parent ed2fd86f6b
commit 9a01426864
21 changed files with 1219 additions and 10 deletions
@@ -5,6 +5,7 @@ namespace Tests\Feature;
use App\Jobs\ScanDocumentForMalware;
use App\Models\Opportunity;
use App\Models\User;
use App\Services\InvestorContext;
use App\Services\OpportunityManagement;
use App\Services\PortalProfileAdministration;
use App\Services\PrivateOfferConfidentiality;
@@ -19,6 +20,7 @@ use Illuminate\Support\Facades\Queue;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
use Illuminate\Testing\TestResponse;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Tests\Support\CleanScannerFixture;
use Tests\TestCase;
@@ -238,6 +240,14 @@ final class PrivateOfferConfidentialityTest extends TestCase
$data = $this->login($interested)->getJson($url.'/confidencial')->assertOk()->assertJsonPath('business.revenue', '789.01')->getContent();
$this->assertStringNotContainsString('PRIVATE-CONTACT-CANARY', $data);
$this->assertStringNotContainsString('PRIVATE-DESCRIPTION-CANARY', $data);
// NDA permission is a bounded read, not permission to copy the private
// Opportunity into another investment context or its downstream reports.
try {
app(InvestorContext::class)->reference('opportunity:'.$record->id);
$this->fail('An NDA grant must not grant private investment-context access.');
} catch (HttpException $error) {
$this->assertSame(404, $error->getStatusCode());
}
$this->login($this->actor())->getJson($url.'/confidencial')->assertForbidden();
$this->login($owner)->postJson($url.'/confidencialidade', $this->command($record, $nda, 'revoke', ['interested_user_id' => $interested->id]))->assertOk();
$this->login($interested)->getJson($url.'/confidencial')->assertForbidden();