Session->valid()) { $this->Session->renew(); } if (!$this->Session->check(USER_LOGIN_KEY)) { $this->Session->write(USER_LOGIN_KEY,ANONY_USER); } // here we check the permissions based on // username and controller name (which is // is the first part of the URL) $user = $this->Session->read(USER_LOGIN_KEY); $aco = $this->params['controller']; if ($this->Acl->check($user, "/$aco", '*')) { return; }else{ // if anonymous, redirect to login // otherwise, give permission error if( $user == ANONY_USER){ $this->redirect("/authentications/login"); }else{ $this->redirect("/pages/permission_denied"); } } } } ?>