<?php declare(strict_types=1);
namespace Sq\Service\Security\Voter\Invoice;
use Sq\Entity\Schema\ORM\UserOrganizationAssignment;
use Sq\Service\Security\Voter\SecurityAttributes;
class ViewInvoiceVoter extends AbstractInvoiceVoter
{
protected function getSupportedAttributeName(): string
{
return SecurityAttributes::VIEW;
}
protected function getValidRolesForAttribute(): array
{
return [
UserOrganizationAssignment::ROLE_OWNER,
UserOrganizationAssignment::ROLE_ADMIN // TODO-Overhaul-Alpha should they be allowed?
];
}
protected function isAllowedWhenImpersonating(): bool
{
return true;
}
}