11.26 php saved
predominant
Tags add more
Acl Auth AppControll  
Note
Acl and Auth AppController
  1. class AppController extends Controller
  2. {
  3.     var $helpers = array(
  4.         'Html',
  5.         'Javascript',
  6.         'Form',
  7.         'Time');
  8.  
  9.     var $components = array(
  10.         'Acl',
  11.         'Auth',
  12.         'Session');
  13.  
  14.     var $publicControllers = array(
  15.         'pages');
  16.  
  17.     function beforeFilter()
  18.     {
  19.         if (isset($this->Auth))
  20.         {
  21.             Security::setHash('md5');
  22.  
  23.             $this->Auth->authorize = 'actions';
  24.             $this->Auth->userModel = 'Employee';
  25.  
  26.             $this->Auth->userScope = array("Employee.status_id" => 1);
  27.             $this->Auth->loginAction = array(
  28.                 'controller' => 'employees',
  29.                 'action'     => 'login');
  30.             $this->Auth->loginRedirect = array(
  31.                 'controller' => 'employees',
  32.                 'action'     => 'summary');
  33.             $this->Auth->fields = array(
  34.                 'username'   => 'email',
  35.                 'password'   => 'password_md5');
  36.             $this->Auth->logoutRedirect = array(
  37.                 'controller' => 'employees',
  38.                 'action'     => 'login');
  39.  
  40.             $this->Auth->loginError = 'An error occurred logging you in.';
  41.             $this->Auth->authError  = 'You are not authorised to view this page.';
  42.  
  43.             if (in_array(low($this->name), $this->publicControllers))
  44.                 $this->Auth->allow();
  45.         }
  46.     }
  47. }
  48.  
Parsed in 0.092 seconds, using GeSHi 1.0.7.14

Modify this Paste