title: Grails Spring security core pre-logout
body: <p>I'm using Grails Spring Security Core plugin and I need to perform a few actions when logout happens such as delete some class instances related to the user. I tried the following code:</p>
  
  <pre><code>import org.codehaus.groovy.grails.plugins.springsecurity.SpringSecurityUtils
  import grails.plugins.springsecurity.Secured
  
  class LogoutController {
  
  def index = {
      def currentUser = currentUser()
      currentUser.searchedResults.each{searched-&gt;
          def searchInstance = Search.get(searched.searchId)
          searchInstance.delete()
      }
      redirect uri: SpringSecurityUtils.securityConfig.logout.filterProcessesUrl // '/j_spring_security_logout'
  }
  
  private currentUser(){
      return User.get(springSecurityService.principal.id)
  }
  }
  </code></pre>
  
  <p>However Grails is giving the error: <em>No such property: User for class: LogoutController</em> 
  My guess is that this is happening because when I installed Spring security core plugin, the LogoutController and LoginController were created in a different package called "default package". Is there any way to overcome this issue? Any help would be appreciated! Thanks</p>