feat: prepare private offers through existing opportunities

This commit is contained in:
2026-11-14 13:41:31 +02:00
parent e8408c27d9
commit 1f2990e4da
17 changed files with 1211 additions and 26 deletions
+2 -1
View File
@@ -24,7 +24,7 @@ class OpportunityProfileWorkflow
/** @return list<string> */
public function actions(User $actor, Opportunity $record): array
{
if ($record->owner_user_id === null || ! $this->access->canView($actor, $record)) {
if ($record->isPrivateOfferPreparation() || $record->owner_user_id === null || ! $this->access->canView($actor, $record)) {
return [];
}
$actions = [];
@@ -520,6 +520,7 @@ class OpportunityProfileWorkflow
private function authorizeAction(User $actor, Opportunity $record, string $action): void
{
abort_if($record->isPrivateOfferPreparation(), 403, 'A oferta está em preparação privada; o circuito editorial não está disponível nesta fase.');
$this->access->authorize($actor, 'view', $record);
$promoter = $this->access->promoterRecordScope($actor, $record)
&& ($record->organization_id !== null || (int) $record->owner_user_id === $actor->id);