Subversion Repositories SmartDukaan

Rev

Rev 15227 | Rev 15335 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 15227 Rev 15311
Line 12... Line 12...
12
 */
12
 */
13
class AppController extends Controller {
13
class AppController extends Controller {
14
 
14
 
15
	public $limit;
15
	public $limit;
16
	public $apihost;
16
	public $apihost;
-
 
17
	public $acls;
17
 
18
 
18
	public $components = array(
19
	public $components = array(
19
		'Session','Resize','Cookie',
20
		'Session','Resize','Cookie',
20
		'Auth' => array(
21
		'Auth' => array(
21
			'loginAction' => array('controller' => 'users', 'action' => 'login'),
22
			'loginAction' => array('controller' => 'users', 'action' => 'login'),
Line 94... Line 95...
94
					$acls[$value['Acl']['group_id']]['disallowed'][] = $value['Acl']['action'];
95
					$acls[$value['Acl']['group_id']]['disallowed'][] = $value['Acl']['action'];
95
				}				
96
				}				
96
			}
97
			}
97
			Cache::write($cachekey,$acls,'month');
98
			Cache::write($cachekey,$acls,'month');
98
		}
99
		}
-
 
100
		$this->acls = $acls;
99
		$this->set('acls',$acls);
101
		$this->set('acls',$acls);
100
    }
102
    }
101
	
103
	
102
	function checkAcl() {
104
	function checkAcl() {		
103
    	if(!in_array($this->here,$this->acls[$logged_user['group_id']]['allowed'])){
105
    	if(!in_array($this->here,$this->acls[$this->Session->read('Auth.User.group_id')]['allowed'])){
104
    		$this->Session->setFlash(__('You are not authorized to access this page.'));
106
    		$this->Session->setFlash(__('You are not authorized to access this page.'));
105
    		return $this->redirect(array('controller'=>'administration','action' => 'dashboard','admin'=>false));
107
    		return $this->redirect(array('controller'=>'administration','action' => 'dashboard','admin'=>false));
106
    	}
108
    	}
107
    }
109
    }
108
 
110
 
Line 152... Line 154...
152
				}
154
				}
153
			}
155
			}
154
        } else {
156
        } else {
155
        	return true;
157
        	return true;
156
        }
158
        }
157
        return false;
159
        return true;
158
    }
160
    }
159
 
161
 
160
    function getallheaders() { 
162
    function getallheaders() { 
161
	   $headers = ''; 
163
	   $headers = ''; 
162
       foreach ($_SERVER as $name => $value) 
164
       foreach ($_SERVER as $name => $value)