Show
Ignore:
Timestamp:
05/21/08 11:43:42 (7 months ago)
Author:
aarkerio
Message:

New Try

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/app/app_controller.php

    r538 r540  
    1818 public function beforeFilter() 
    1919 { 
    20      $this->Auth->fields         = array('username' => 'email', 'password' => 'pwd'); 
    21      $this->Auth->loginAction    = array('controller' => 'users', 'action' => 'login'); 
    22      $this->Auth->loginRedirect  = array('controller' => 'news', 'action' => 'display'); 
    23      $this->Auth->logoutRedirect = '/news/display'; 
     20     $this->Auth->fields         = array('username'   => 'email', 'password' => 'pwd'); 
     21     $this->Auth->loginAction    = array('controller' => 'users', 'action'   => 'login'); 
     22     $this->Auth->loginRedirect  = array('controller' => 'news', 'action'    => 'display'); 
     23     $this->Auth->logoutRedirect = array('controller' => 'news', 'action'    => 'display'); 
    2424     $this->Auth->loginError     = 'Invalid e-mail / password combination. Please try again'; 
    2525     $this->Auth->authorize      = 'controller';   
     
    2828     $this->set('cU', $this->Auth->user());  // $cU current user array to use in the views if user logged in 
    2929 } 
     30 
     31 public function isAuthorized()  
     32 {       
     33   if (isset( $this->params[Configure::read('Routing.admin')] )): 
     34       if ($this->Auth->user('group_id') == 1 || $this->Auth->user('group_id') == 2 ):  // admin and teachers 
     35          return true; 
     36       else: 
     37              return false; 
     38       endif; 
     39   endif; 
    3040  
     41   return true; 
     42 } 
     43 
    3144 public function msgFlash($msg, $to) 
    3245 {