Merge pull request #79 from gabriel403/hotfix/75

Fixes #75 user entity not being in the registry
This commit is contained in:
Dan Cryer 2013-06-05 06:45:42 -07:00
commit ef24d4c60d
2 changed files with 4 additions and 4 deletions

View file

@ -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;
}

View file

@ -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);