removed deprecated registry and use session
This commit is contained in:
parent
3dd6217133
commit
757a82c26f
|
@ -10,7 +10,6 @@
|
||||||
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;
|
||||||
|
|
||||||
|
@ -36,9 +35,6 @@ class Application extends b8\Application
|
||||||
$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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -86,10 +86,10 @@ class BuildController extends \PHPCI\Controller
|
||||||
*/
|
*/
|
||||||
public function delete($buildId)
|
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.');
|
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