resolver = $resolver; } protected function supports($attribute, $subject) { // replace with your own logic // https://symfony.com/doc/current/security/voters.html //return ($subject instanceof Part || in_array($subject, ['PERM_parts', 'PERM_parts_name'])); if ($subject instanceof Part) { return in_array($attribute, $this->resolver->listOperationsForPermission('parts'), false); } return false; } protected function voteOnAttribute($attribute, $subject, TokenInterface $token) { $user = $token->getUser(); // if the user is anonymous, do not grant access if (!$user instanceof User) { return false; } if($subject instanceof Part) { //Null concealing operator means, that no return $this->resolver->inherit($user, 'parts', $attribute) ?? false; } //Deny access by default. return false; } }