Added voter reason explaination to the other voters

This commit is contained in:
Jan Böhmer 2025-09-06 00:24:55 +02:00
parent 117ff4484d
commit eb4258053e
14 changed files with 65 additions and 35 deletions

View file

@ -33,6 +33,7 @@ use App\Entity\Parts\Supplier;
use App\Entity\PriceInformations\Currency;
use App\Services\UserSystem\VoterHelper;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authorization\Voter\Vote;
use Symfony\Component\Security\Core\Authorization\Voter\Voter;
use function is_object;
@ -113,10 +114,10 @@ final class StructureVoter extends Voter
*
* @param string $attribute
*/
protected function voteOnAttribute(string $attribute, $subject, TokenInterface $token): bool
protected function voteOnAttribute(string $attribute, $subject, TokenInterface $token, ?Vote $vote = null): bool
{
$permission_name = $this->instanceToPermissionName($subject);
//Just resolve the permission
return $this->helper->isGranted($token, $permission_name, $attribute);
return $this->helper->isGranted($token, $permission_name, $attribute, $vote);
}
}