/
app_controller.php
executable file
·57 lines (44 loc) · 1.44 KB
/
app_controller.php
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
50
51
52
53
54
55
56
57
<?php
/**
* Short description for class.
*
* Add your application-wide methods in the class below, your controllers
* will inherit them.
*
* @package cake
* @subpackage cake.app
*/
class AppController extends Controller {
var $helpers = array('Html', 'Form', 'Time', 'Javascript', 'Text', 'Vistas');
var $components = array('Auth', 'RequestHandler');
function beforeFilter() {
$this->Auth->authorize = 'controller' ;
$this->Auth->userModel = 'Organizacion' ;
$this->Auth->fields = array(
'username' => 'email',
'password' => 'password'
);
$this->Auth->loginAction = array('controller' => 'organizaciones', 'action' => 'ingreso');
$this->Auth->loginRedirect = array('controller' => 'organizaciones', 'action' => 'ver', $this->Auth->user('id'));
$this->Auth->logoutRedirect = '/';
$this->Auth->loginError = 'El correo electrónico o la contraseña estan incorrectas.';
$this->Auth->authError = 'No tienes autorización para ingresar a esta sección.';
$auth = $this->Auth->user() != null;
$user = $this->Auth->user();
$this->set(compact('auth', 'user'));
$this->RequestHandler->setContent('json', 'text/x-json');
/*
if(Configure::read())
$this->Auth->allow('*');
*/
$this->Auth->allow('display');
}
function beforeRender() {
if($this->RequestHandler->responseType() == 'json')
Configure::write('debug', 0);
}
function isAuthorized() {
return true ;
}
}
?>