Fix user entity not bein in registry
This commit is contained in:
parent
9574b63470
commit
4eadb1aef3
|
@ -10,6 +10,7 @@
|
||||||
namespace PHPCI;
|
namespace PHPCI;
|
||||||
|
|
||||||
use b8;
|
use b8;
|
||||||
|
use b8\Registry;
|
||||||
use b8\Http\Response\RedirectResponse;
|
use b8\Http\Response\RedirectResponse;
|
||||||
use b8\View;
|
use b8\View;
|
||||||
|
|
||||||
|
@ -33,8 +34,11 @@ class Application extends b8\Application
|
||||||
$sessionAction = ($this->controllerName == 'Session' && in_array($this->action, array('login', 'logout')));
|
$sessionAction = ($this->controllerName == 'Session' && in_array($this->action, array('login', 'logout')));
|
||||||
$externalAction = in_array($this->controllerName, array('Bitbucket', 'Github', 'BuildStatus'));
|
$externalAction = in_array($this->controllerName, array('Bitbucket', 'Github', 'BuildStatus'));
|
||||||
$skipValidation = ($externalAction || $sessionAction);
|
$skipValidation = ($externalAction || $sessionAction);
|
||||||
|
|
||||||
if($skipValidation || $this->validateSession()) {
|
if($skipValidation || $this->validateSession()) {
|
||||||
|
if ( !empty($_SESSION['user']) ) {
|
||||||
|
Registry::getInstance()->set('user', $_SESSION['user']);
|
||||||
|
}
|
||||||
parent::handleRequest();
|
parent::handleRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +47,7 @@ class Application extends b8\Application
|
||||||
$view->content = $this->response->getContent();
|
$view->content = $this->response->getContent();
|
||||||
$this->response->setContent($view->render());
|
$this->response->setContent($view->render());
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->response;
|
return $this->response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,7 @@ class BuildController extends \PHPCI\Controller
|
||||||
if (!Registry::getInstance()->get('user')->getIsAdmin()) {
|
if (!Registry::getInstance()->get('user')->getIsAdmin()) {
|
||||||
throw new \Exception('You do not have permission to do that.');
|
throw new \Exception('You do not have permission to do that.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$build = $this->_buildStore->getById($buildId);
|
$build = $this->_buildStore->getById($buildId);
|
||||||
$this->_buildStore->delete($build);
|
$this->_buildStore->delete($build);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue