CakeAuth->set(); // Load data if( !$this->CakeAuth->id ) { // Not yet logged in or authenticated $this->CakeAuth->saveUrl( $this->here ); // Save url for redirect after logged in $this->redirect('/cake_login/'); // Show login page exit(); } if ( !$this->CakeAuth->check( $this->name, $this->action) ) { // Logged but not authorized $this->Session->setFlash('Warning: Access denied.', null); // Set Flash message $this->redirect('/'); // Redirect to home page exit(); } $this->set('CakeAuth', $this->CakeAuth); // Make the CakeAuth object avalaible to views return true; } ?>