Action->setPermission() method signature is incorrect
I'm using the latest EasyAdmin 4. To verify if a user can execute an action or not, you use Symfony AuthorizationChecker's isGranted() method, which has the following signature:
public function isGranted(mixed $attribute, mixed $subject = null): bool;
Note that the second parameter is "mixed", not string, to allow passing Symfony\Component\ExpressionLanguage\Expression instances too. The problem is that your setPermission() method on the actions cast this object to string, transforming the expression to a single-role check, which obviously always fail.
To FIX, you just have to change these two lines:
src/Config/Actions.php
public function setPermission(string $actionName, **mixed** $permission): self
src/Dto/ActionConfigDto.php
public function setActionPermission(string $actionName, **mixed** $permission): void
This allows for multiple and complex role checking, as requested also by issue #5861.
Thanks for reporting this. It was fixed in #6130. Instead of using mixed, we used string|Expression as the type of this variable.