/**
  * beforeFilter callback
  *
  * @param Event $event An Event instance.
  * @return void
  */
 public function beforeFilter(Event $event)
 {
     parent::beforeFilter($event);
     $this->Auth->deny();
     if (!$this->Auth->user()) {
         $this->Auth->config('authError', false);
     } else {
         Wasabi::user(new User($this->Auth->user()));
         $currentUrlArray = Wasabi::getCurrentUrlArray();
         $currentRequestPath = join('.', [$currentUrlArray['plugin'], $currentUrlArray['controller'], $currentUrlArray['action']]);
         if (!$this->request->is('ajax') || $currentRequestPath !== 'Wasabi/Core.Users.heartBeat') {
             $this->request->session()->write('loginTime', time());
         }
     }
     $this->_allow();
     Wasabi::loadLanguages(null, true);
     // Load all menu items from all plugins.
     $this->eventManager()->dispatch(new Event('Wasabi.Backend.Menu.initMain', Nav::createMenu('backend.main')));
     $this->_setSectionCssClass();
     $this->set('heartBeatFrequency', $this->_calculateHeartBeatFrequency());
     if ($this->request->is('ajax')) {
         $this->viewClass = null;
     }
 }
Exemple #2
0
 /**
  * Prepares the menu items before rendering the cell.
  *
  * @param string $alias the name of the menu.
  * @return void
  */
 public function display($alias)
 {
     $items = Nav::getMenu($alias, true);
     $this->set('menuItems', $this->_processMenuItems($items, $this->request->params));
 }