title: Symfony 2: Get Security Context Outside of Controller
body: <p>I am trying to write an event listener that needs access to the users permission level. In the controller I use the following code</p>
  
  <p><strong>Code:</strong></p>
  
  <pre><code>$securityContext = $this-&gt;container-&gt;get('security.context');
  
  if($securityContext-&gt;isGranted('ROLE_USER')){
      //Do Something
  }
  </code></pre>
  
  <p>But outside of a controller I can't work out how to get the security context. Is it possible? </p>