feat: allow project edits only on selected statuses

This commit is contained in:
2026-07-16 16:36:02 +02:00
parent a89dd4bde7
commit e6ce2dff3e
+11 -1
View File
@@ -3,6 +3,7 @@
namespace App\Security\Voter;
use App\ApiResource\Project\ProjectApiResource;
use App\Entity\Project\ProjectStatus;
use App\Entity\User\User;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authorization\Voter\Voter;
@@ -47,6 +48,15 @@ final class ProjectVoter extends Voter
return true;
}
return $this->isOwnerOf($project, $user);
if (!$this->isOwnerOf($project, $user)) {
return false;
}
return in_array($project->status, [
ProjectStatus::InDraft,
ProjectStatus::InCampaignReviewToChange,
ProjectStatus::ToCampaign,
ProjectStatus::InCampaign,
]);
}
}