title: Symfony/DRY - check if user is granted in every action
body: <p>I'm using this code to check if a user is granted in my Symfony application :</p>
  
  <pre><code> $securityContext = $this-&gt;container-&gt;get('security.context');
  
   if($securityContext-&gt;isGranted('IS_AUTHENTICATED_REMEMBERED') ){
       $user = $this-&gt;get('security.context')-&gt;getToken()-&gt;getUser()-&gt;getId();
   } else {
       return $this-&gt;render('IelCategoryBundle:Category:home.html.twig');
   }
  </code></pre>
  
  <p>I have to ckeck this in almost every CRUD action that I'm writing (edit, delete, ...).</p>
  
  <p>I feel not DRY at all (no play on words ;-)). Is there a better way to check this in many actions ?</p>