public function beforeFilter() { parent::beforeFilter(); if (!$this->isAdmin() && !in_array($this->action, $this->allowedMethods)) { $this->setFlash('Você não possui acesso aos usuários.', 'alert alert-info'); $this->redirect(array('controller' => 'dashboard', 'action' => 'index')); } }
public function beforeFilter() { parent::beforeFilter(); $allowed = ['login', 'register', 'welcome', 'forgot', 'reset']; $this->Auth->allow($allowed); }
function admin_delete($id = null) { if (!$id) { $this->Session->setFlash('That Category could not be found', true); $this->redirect($this->referer()); } $count = $this->Category->find('count', array('conditions' => array('Category.parent_id' => $id))); if ($count > 0) { $this->Session->setFlash(__('This Category has sub-categories.', true)); $this->redirect($this->referer()); } $category = $this->Category->read(null, $id); if (!empty($category['Content'])) { $this->Session->setFlash(__('There are still content itmes in this category. Remove them and try again.', true)); $this->redirect($this->referer()); } return parent::admin_delete($id); }
public function beforeFilter() { parent::beforeFilter(); $this->set('styles', $this->styles); }
function beforeFilter() { parent::beforeFilter(); $this->Auth->allow('index', 'show'); }
function beforeFilter() { parent::beforeFilter(); }
/** * beforeFilter callback * * @return void */ public function beforeFilter() { parent::beforeFilter(); $this->set('model', $this->modelClass); }