forked from hantsy/angularjs-cakephp-sample
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAppController.php
More file actions
49 lines (42 loc) · 1.15 KB
/
Copy pathAppController.php
File metadata and controls
49 lines (42 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
/**
* Application level Controller
*
* This file is application-wide controller file. You can put all
* application-wide controller-related methods here.
*
* PHP 5
*
* @link http://cakephp.org CakePHP(tm) Project
* @package app.Controller
* @since CakePHP(tm) v 0.2.9
*/
App::uses('Controller', 'Controller');
/**
* Application Controller
*
* Add your application-wide methods in the class below, your controllers
* will inherit them.
*
* @package app.Controller
* @link http://book.cakephp.org/2.0/en/controllers.html#the-app-controller
*/
class AppController extends Controller {
public $components = array('Auth', 'Session');
public function beforeFilter() {
$this->Auth->authorize = array('Controller');
$this->Auth->authenticate = array(
'all' => array(
//'scope' => array('User.is_active' => 1)
),
'Basic'
);
$this->Auth->allow('index', 'view');
}
public function isAuthorized($user) {
if (isset($user['role']) && ($user['role'] == 'admin')) {
return true;
}
return false;
}
}