title: CakePHP - Call to a member function allow() on a non-object error
body: <p>I am creating one login authentication app in CakePHP
  and getting this Fatal error: Call to a member function allow() on a non-object in /var/www/cakephp1/app/Controller/users_controller.php on line 5</p>
  
  <p>and this is my controller code
  <strong>users_controller.php</strong></p>
  
  <pre><code>&lt;?php
  class UsersController extends AppController {
      public function beforeFilter() {
          parent::beforeFilter();
          $this-&gt;Auth-&gt;allow('add');
      }
      public function add() {
          if (!empty($this-&gt;data)) {
              $this-&gt;User-&gt;create();
              if ($this-&gt;User-&gt;save($this-&gt;data)) {
                  $this-&gt;Session-&gt;setFlash('User created!');
                  $this-&gt;redirect(array('action'=&gt;'login'));
              } else {
                  $this-&gt;Session-&gt;setFlash('Please correct the errors');
              }
          }
          $this-&gt;set('groups', $this-&gt;User-&gt;Group-&gt;find('list'));
      }
      public function login() {
      }
      public function logout() {
          $this-&gt;redirect($this-&gt;Auth-&gt;logout());
      }
      public function dashboard() {
          $groupName = $this-&gt;User-&gt;Group-&gt;field('name', 
              array('Group.id'=&gt;$this-&gt;Auth-&gt;user('group_id'))
          );
          $this-&gt;redirect(array('action'=&gt;strtolower($groupName)));
      }
      public function user() {
      }
      public function administrator() {
      }
      public function manager() {
      }
  }
  ?&gt;
  </code></pre>
  
  <p><strong>app_controller.php</strong></p>
  
  <pre><code>&lt;?php
  class AppController extends Controller {
      public $components = array(
          'Acl',
          'Auth' =&gt; array(
              'authorize' =&gt; 'actions',
              'loginRedirect' =&gt; array(
                  'admin' =&gt; false,
                  'controller' =&gt; 'users',
                  'action' =&gt; 'dashboard'
              )
          ),
          'Session'
      );
  }
  ?&gt;
  </code></pre>
  
  <p>View <strong>login.ctp</strong></p>
  
  <pre><code>&lt;?php
  echo $this-&gt;Form-&gt;create(array('action'=&gt;'login'));
  echo $this-&gt;Form-&gt;inputs(array(
      'legend' =&gt; 'Login',
      'username',
      'password',
      'remember' =&gt; array('type' =&gt; 'checkbox', 'label' =&gt; 'Remember me')
  ));
  echo $this-&gt;Form-&gt;end('Login');
  ?&gt;
  </code></pre>
  
  <p>I am using CakePHP version 1.3</p>