the core twig `is_granted` function does the job.