예제 #1
0
 public function beforeFilter()
 {
     parent::beforeFilter();
     // $this->set($this->User->enumValues());
     $this->set('model', $this->modelClass);
     $this->_setupAuth();
 }
 /**
  * Called before the controller action.  You can use this method to configure and customize components
  * or perform logic that needs to happen before each controller action.
  *
  * @return void
  */
 public function beforeFilter()
 {
     parent::beforeFilter();
     if (isset($this->Security) && $this->request->is('ajax')) {
         $this->Security->csrfCheck = false;
         $this->Security->validatePost = false;
     }
 }
예제 #3
0
 public function beforeFilter()
 {
     parent::beforeFilter();
     $this->_setupAuth();
     $this->set('model', $this->modelClass);
     if (!Configure::read('App.defaultEmail')) {
         Configure::write('App.defaultEmail', 'reply@' . env('HTTP_HOST'));
     }
 }
예제 #4
0
 /**
  * Constructor
  *
  */
 public function __construct($request = null, $response = null)
 {
     parent::__construct($request, $response);
     if (CakePlugin::loaded('Invite')) {
         $this->components[] = 'Invite.InviteHandler';
     }
     if (CakePlugin::loaded('Facebook')) {
         $this->helpers[] = 'Facebook.Facebook';
         $this->uses[] = 'Facebook.Facebook';
     }
 }
예제 #5
0
 /**
  * beforeRender
  *
  * @return void
  * @access public
  */
 public function beforeRender()
 {
     parent::beforeRender();
     if (in_array($this->request->params['action'], array('admin_login', 'login'))) {
         if ($this->request->is('post') && !empty($this->request->data)) {
             $field = $this->Auth->authenticate['all']['fields']['username'];
             $cacheName = 'auth_failed_' . $this->request->data['User'][$field];
             $cacheValue = Cache::read($cacheName, 'users_login');
             Cache::write($cacheName, (int) $cacheValue + 1, 'users_login');
         }
     }
 }
예제 #6
0
 /**
  * beforeFilter callback
  *
  * @return void
  */
 public function beforeFilter()
 {
     parent::beforeFilter();
     $this->Auth->allow('register', 'reset', 'verify', 'logout', 'index', 'view', 'reset_password');
     if ($this->action == 'register') {
         $this->Auth->enabled = false;
     }
     if ($this->action == 'login') {
         $this->Auth->autoRedirect = false;
     }
     $this->set('model', $this->modelClass);
     if (!Configure::read('App.defaultEmail')) {
         Configure::write('App.defaultEmail', 'noreply@' . env('HTTP_HOST'));
     }
 }
예제 #7
0
 /**
  * Default isAuthorized method
  *
  * This is called to see if a user (when logged in) is able to access an action
  *
  * @param array $user
  * @return boolean True if allowed
  * @link http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#using-controllerauthorize
  */
 public function isAuthorized($user = null)
 {
     return parent::isAuthorized($user);
 }
예제 #8
0
 /**
  * implementedEvents
  *
  * @return array
  */
 public function implementedEvents()
 {
     return parent::implementedEvents() + array('Controller.Users.beforeAdminLogin' => 'onBeforeAdminLogin', 'Controller.Users.adminLoginFailure' => 'onAdminLoginFailure');
 }
예제 #9
0
 public function admin_add()
 {
     parent::admin_add();
     $groups = $this->{$this->modelClass}->Group->find('list');
     $this->set(compact('groups'));
 }
예제 #10
0
 /**
  * @brief admin edit action
  *
  * Edit old Group records.
  *
  * @todo update the documentation
  * @param mixed $id int or string uuid or the row to edit
  *
  * @return void
  */
 function admin_edit($id = null)
 {
     parent::admin_edit($id);
 }
 function beforeFilter()
 {
     $this->Auth->allow('login', 'admin_login', 'logout', 'forgotten_password', 'reset_password', 'admin_forgotten_password', 'admin_reset_password', 'register', 'activate_with_ticket');
     $this->set('pagePath', $this->adminPagePath);
     parent::beforeFilter();
 }
예제 #12
0
 public function beforeFilter()
 {
     parent::beforeFilter();
     $this->notice(__d('users', 'ACL is not currently in use'), array('level' => 'warning', 'redirect' => true));
 }
예제 #13
0
 /**
  * Default isAuthorized method
  *
  * This is called to see if a user (when logged in) is able to access an action
  *
  * @param array $user
  * @return boolean True if allowed
  * @link http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#using-controllerauthorize
  */
 public function isAuthorized($user = null)
 {
     $ret = parent::isAuthorized($user);
     if ($this->action == 'index') {
         if (!array_key_exists('is_admin', $user)) {
             $ret = false;
         }
         //si es admin general esta autorizado
         if (empty($user['is_admin'])) {
             $ret = false;
         }
     }
     return $ret;
 }
예제 #14
0
 /**
  * Before Render method
  * 
  */
 public function beforeRender()
 {
     $this->layout = 'default';
     return parent::beforeRender();
 }