title: cakePHP ACL when not logged in
body: <p>I have an application where all users have to be logged in. I'm using the <code>Auth</code> component for authentication, and <code>ACL</code> for authorization.</p>
  
  <p>I'm basically doing something like this in the `beforeFilter() of an admin controller:</p>
  
  <pre><code>if(!$this-&gt;Acl-&gt;check(array('model' =&gt; 'User', 'foreign_key' =&gt; $this-&gt;Auth-&gt;user()['id']), 'Admin', 'read')) 
  {
      pr('You are NOT allowed to be here!');
  } 
  </code></pre>
  
  <p>This works well for any logged in user, some users can see the admin pages, and some cannot.</p>
  
  <p>However, when I go to <em>/admin</em> when NOT logged in, I get:</p>
  
  <blockquote>
    <p>AclNode::node() - Couldn&#039;t find Aro node identified by
    &quot;Array ( [Aro0.model] =&gt; model [Aro0.foreign_key] =&gt; U )
    &quot;</p>
  </blockquote>
  
  <p>(I don't know why it prints the 'U'). It's like it's trying to do the lookup, but since the user information isn't there, it crashes. I'm sure I'm missing something here. I can avoid the problem by checking if the user is logged in:</p>
  
  <pre><code>if($this-&gt;Auth-&gt;user()) //do the ACL check
  </code></pre>
  
  <p>But I don't like that approach, and I guess it is wrong.</p>
  
  <p>Do I need some kind of default setting?</p>