src/Security/Voter/ObjectManagement/ObjectsdeviceVoter.php line 10

Open in your IDE?
  1. <?php
  2. namespace App\Security\Voter\ObjectManagement;
  3. use App\Daikin\BaseBundle\Entity\Objectsdevice;
  4. use App\Security\Voter\SubjectCompanyOwnerVoterTrait;
  5. use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
  6. use Symfony\Component\Security\Core\Authorization\Voter\Voter;
  7. class ObjectsdeviceVoter extends Voter
  8. {
  9.     use SubjectCompanyOwnerVoterTrait;
  10.     protected function supports(string $attribute$subject): bool
  11.     {
  12.         return $subject instanceof Objectsdevice;
  13.     }
  14.     public function supportsType(string $subjectType): bool
  15.     {
  16.         return is_a($subjectTypeObjectsdevice::class, true);
  17.     }
  18.     protected function voteOnAttribute(string $attribute$subjectTokenInterface $token): bool
  19.     {
  20.         return $this->companyOwnsSubject($token->getUser(), $subject);
  21.     }
  22. }