title: CakePHP 2.0 Auth->user()
body: <p>I'm trying to implement an ACL-Based authorization for my web-project.
  I have a login method:</p>
  
  <pre><code>function login() {
    if ($this-&gt;request-&gt;is('post')) {
      if ($this-&gt;Auth-&gt;login()) {
        debug($this-&gt;Auth-&gt;user());
        //return $this-&gt;redirect($this-&gt;Auth-&gt;redirect());
      } else {
        $this-&gt;Session-&gt;setFlash(__('Username or password is incorrect'), 'default', array(), 'auth');
      }
    }
  }
  </code></pre>
  
  <p>Instead of redirecting, I print the logged in user information. And this works well.
  However, if I <code>debug($this-&gt;Auth-&gt;user())</code> in the <code>AppController</code></p>
  
  <pre><code>function beforeFilter() {
    parent::beforeFilter();
  
    debug($this-&gt;Auth-&gt;user());
  
    $user = $this-&gt;Auth-&gt;user();
    if ($user) {
      $this-&gt;set('isAuthed', true);
      $this-&gt;_userId = (int) $user['User']['id'];
    } else {
      $this-&gt;set('isAuthed', false);
    }
  }
  </code></pre>
  
  <p>I get nothing. What might be the problem?</p>