public function beforeFilter(\Cake\Event\Event $event)
 {
     parent::beforeFilter($event);
     if (!$this->Auth->user('admin')) {
         return $this->redirect(['controller' => 'Users', 'action' => 'index']);
     }
 }
 public function beforeFilter(\Cake\Event\Event $event)
 {
     parent::beforeFilter($event);
     $whiteList = Configure::read('Users.white_list');
     if (Configure::read('Users.open_registration')) {
         $whiteList[] = 'register';
     }
     $this->Auth->allow($whiteList);
 }