* @var boolean
*/
public $haveErrors = false;
-
-
+
+
public $validator;
public $errors ;
-
-
+
+
use \Crud\Controller\ControllerTrait;
public $components = [
]
]
];
-
-
+
+
/**
* Initialization hook method.
*
public function initialize()
{
parent::initialize();
-
+
$this->loadComponent('RequestHandler');
-
+
$this->loadComponent('Flash');
-
- $this->loadComponent('Auth', [
- 'authenticate' => [
- 'Form' => [
- 'fields' => ['username' => 'username', 'password' => 'password']
- ]
- ]
- ]);
- }
-
- public function isAuthorized($user)
- {
- // Admin peuvent accéder à chaque action
- if (isset($user['role']) && ($user['role'] === 'admin')) {
- return true;
+
}
-
- // Par défaut refuser
- return true;
- }
-
-
+
+
/**
* Before render callback.
*
$this->RequestHandler->renderAs($this, 'json');
$this->set('_serialize', true);
}
-
+
$pagination = $this->request->paging[$this->modelClass];
if (empty($pagination)) {
return;
'limit' => $pagination['limit']
];
- $this->set('pagination', $paginationResponse);
-
$this->set('paging',$this->request->params['paging']);
-
-// $this->RequestHandler->renderAs($this, 'json');
-//
-// $this->set('_serialize', true);
-//
-
}
-
+
/**
- *
+ *
* @param Event $event
*/
public function beforeFilter(Event $event) {
- $this->Auth->allow();
parent::beforeFilter($event);
}
-
+
}