diff --git a/PHPCI/Application.php b/PHPCI/Application.php index c0048adf..9e555d5c 100644 --- a/PHPCI/Application.php +++ b/PHPCI/Application.php @@ -33,7 +33,7 @@ class Application extends b8\Application $sessionAction = ($this->controllerName == 'Session' && in_array($this->action, array('login', 'logout'))); $externalAction = in_array($this->controllerName, array('Bitbucket', 'Github', 'BuildStatus')); $skipValidation = ($externalAction || $sessionAction); - + if($skipValidation || $this->validateSession()) { parent::handleRequest(); } @@ -43,7 +43,7 @@ class Application extends b8\Application $view->content = $this->response->getContent(); $this->response->setContent($view->render()); } - + return $this->response; } diff --git a/PHPCI/Controller/BuildController.php b/PHPCI/Controller/BuildController.php index 21de59c9..b41287aa 100644 --- a/PHPCI/Controller/BuildController.php +++ b/PHPCI/Controller/BuildController.php @@ -86,10 +86,10 @@ class BuildController extends \PHPCI\Controller */ public function delete($buildId) { - if (!Registry::getInstance()->get('user')->getIsAdmin()) { + if (empty($_SESSION['user']) || !$_SESSION['user']->getIsAdmin()) { throw new \Exception('You do not have permission to do that.'); } - + $build = $this->_buildStore->getById($buildId); $this->_buildStore->delete($build);