Closed budzik closed 1 month ago
looks like for global actions we should use expressions not voter.
//UserCrudController [...] use Symfony\Component\ExpressionLanguage\Expression; use App\Security\Voter\UserVoter; [...] `
public function configureActions(Actions $actions): Actions { return $actions ->disable(Action::BATCH_DELETE) ->setPermission(Action::EDIT, UserVoter::EDIT) ->setPermission(Action::DELETE, UserVoter::DELETE) ->setPermission(Action::NEW, new Expression('"ROLE_MODERATOR" in role_names')) ; } `
Describe the bug sf7.0.6 ea 4.9.4
it looks like custom voter works for edit and delete which I defined. By adding permission for ACTION::NEW, the button above grid disappears automatically in the records list.
this is just a shot - voter works for dropdown links but [add new] action is a button above the list
To Reproduce //UserVoter ... switch ($attribute) { case self::NEW: return true; break; ...
//UserCrudController ...
[\Override]
...