diff --git a/src/Bundle/ChillMainBundle/Security/Authorization/SavedExportVoter.php b/src/Bundle/ChillMainBundle/Security/Authorization/SavedExportVoter.php index 43e788c90..8c4db8a60 100644 --- a/src/Bundle/ChillMainBundle/Security/Authorization/SavedExportVoter.php +++ b/src/Bundle/ChillMainBundle/Security/Authorization/SavedExportVoter.php @@ -60,7 +60,12 @@ class SavedExportVoter extends Voter private function canUserGenerate(User $user, SavedExport $savedExport): bool { - return ($savedExport->getUser() === $user || $savedExport->isSharedWithUser($user)) - && $this->security->isGranted(ChillExportVoter::EXPORT, $this->exportManager->getExport($savedExport->getExportAlias())); + if (!($savedExport->getUser() === $user || $savedExport->isSharedWithUser($user))) { + return false; + } + + $export = $this->exportManager->getExport($savedExport->getExportAlias()); + + return $this->exportManager->isGrantedForElement($export); } } diff --git a/src/Bundle/ChillMainBundle/Tests/Entity/Workflow/SavedExportTest.php b/src/Bundle/ChillMainBundle/Tests/Entity/Workflow/SavedExportTest.php index 999d127ed..cd98df66f 100644 --- a/src/Bundle/ChillMainBundle/Tests/Entity/Workflow/SavedExportTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Entity/Workflow/SavedExportTest.php @@ -1,13 +1,26 @@ prophesize(Security::class); if (null !== $isGranted) {