mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-04 05:44:58 +00:00
Layout of saved export page
This commit is contained in:
@@ -11,6 +11,9 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\MainBundle\Security\Authorization;
|
||||
|
||||
use Chill\MainBundle\Export\DirectExportInterface;
|
||||
use Chill\MainBundle\Export\ExportInterface;
|
||||
use Chill\MainBundle\Export\ExportManager;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
||||
use Symfony\Component\Security\Core\Authorization\Voter\Voter;
|
||||
|
||||
@@ -20,7 +23,7 @@ class ChillExportVoter extends Voter
|
||||
|
||||
private readonly VoterHelperInterface $helper;
|
||||
|
||||
public function __construct(VoterHelperFactoryInterface $voterHelperFactory)
|
||||
public function __construct(VoterHelperFactoryInterface $voterHelperFactory, ExportManager $exportManager)
|
||||
{
|
||||
$this->helper = $voterHelperFactory
|
||||
->generate(self::class)
|
||||
@@ -30,6 +33,13 @@ class ChillExportVoter extends Voter
|
||||
|
||||
protected function supports($attribute, $subject): bool
|
||||
{
|
||||
if (
|
||||
($subject instanceof ExportInterface or $subject instanceof DirectExportInterface)
|
||||
&& $attribute === $subject->requiredRole()
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return $this->helper->supports($attribute, $subject);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user