This commit is contained in:
2022-02-25 09:29:28 +01:00
parent c4e0b68ebe
commit 051ed19f97
11 changed files with 82 additions and 81 deletions

View File

@@ -12,9 +12,7 @@ declare(strict_types=1);
namespace Chill\BudgetBundle\Security\Authorization;
use Chill\BudgetBundle\Entity\AbstractElement;
use Chill\MainBundle\Entity\User;
use Chill\MainBundle\Security\Authorization\AbstractChillVoter;
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
use Chill\MainBundle\Security\Authorization\VoterHelperFactoryInterface;
use Chill\MainBundle\Security\Authorization\VoterHelperInterface;
use Chill\MainBundle\Security\ProvideRoleHierarchyInterface;
@@ -46,12 +44,11 @@ class BudgetElementVoter extends AbstractChillVoter implements ProvideRoleHierar
public function __construct(VoterHelperFactoryInterface $voterFactory)
{
$this->voter = $voterFactory
->generate(self::class)
->addCheckFor(AbstractElement::class, self::ROLES)
->addCheckFor(Person::class, [self::CREATE, self::SEE])
->addCheckFor(Household::class, [self::CREATE, self::SEE])
->build();
->generate(self::class)
->addCheckFor(AbstractElement::class, self::ROLES)
->addCheckFor(Person::class, [self::CREATE, self::SEE])
->addCheckFor(Household::class, [self::CREATE, self::SEE])
->build();
}
public function getRoles(): array
@@ -77,8 +74,6 @@ class BudgetElementVoter extends AbstractChillVoter implements ProvideRoleHierar
protected function voteOnAttribute($attribute, $subject, TokenInterface $token)
{
return $this->voter->voteOnAttribute($attribute, $subject, $token);
}
}