Esempio n. 1
0
 protected function render($view)
 {
     $view = parent::render($view);
     if (!\Staq\Util::isStack($view, 'Stack\\View')) {
         $page = new \Stack\View();
         $page['content'] = $view;
         $view = $page;
     }
     return $view->render();
 }
Esempio n. 2
0
 protected function callController($controller, $action, $route)
 {
     $controllers = $this->setting->getAsArray('auth.controller');
     $exclude = $this->setting['auth.mode'] == 'exclude';
     $level = $this->setting->get('auth.level', 0);
     $inner = in_array($controller, $controllers);
     if ($exclude xor $inner) {
         if (!\Staq::Ctrl('Auth')->isLogged()) {
             throw new \Stack\Exception\MustBeLogged();
         }
         $user = \Staq::Ctrl('Auth')->currentUser();
         if ($user->hasAttribute('right')) {
             if ($user->getAttribute('right')->getSeed() < $level) {
                 throw new \Stack\Exception\NotAllowed();
             }
         }
     }
     $result = parent::callController($controller, $action, $route);
     return $result;
 }