app/Service/Security/Voter/Invoice/ViewInvoiceVoter.php line 8

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Sq\Service\Security\Voter\Invoice;
  3. use Sq\Entity\Schema\ORM\UserOrganizationAssignment;
  4. use Sq\Service\Security\Voter\SecurityAttributes;
  5. class ViewInvoiceVoter extends AbstractInvoiceVoter
  6. {
  7.     protected function getSupportedAttributeName(): string
  8.     {
  9.         return SecurityAttributes::VIEW;
  10.     }
  11.     protected function getValidRolesForAttribute(): array
  12.     {
  13.         return [
  14.             UserOrganizationAssignment::ROLE_OWNER,
  15.             UserOrganizationAssignment::ROLE_ADMIN // TODO-Overhaul-Alpha should they be allowed?
  16.         ];
  17.     }
  18.     protected function isAllowedWhenImpersonating(): bool
  19.     {
  20.         return true;
  21.     }
  22. }