title: Spring Security: method to check if a user has a Hierarchical Role
body: <p>how i can check if a user has a hierarchical role at runtime ?
  I know this solution for the url authorization <code>@PreAuthorize("hasRole('ROLE_ADMIN')")</code>
  but inside a method if i have to check the role ?</p>
  
  <p>For example:</p>
  
  <p>ROLE_ADMIN > ROLE_USER > ROLE_GUEST</p>
  
  <pre><code>if (user.hasRole('ROLE_USER')){
      do something;
  }
  </code></pre>
  
  <p>In this example the condition must to be true if the user has the ROLE_ADMIN because in hierarchical roles ROLE_ADMIN > ROLE_USER.</p>
  
  <p>Thanks</p>