parent
1d55ae11b2
commit
a92585fcb8
8 changed files with 29 additions and 26 deletions
|
|
@ -141,7 +141,7 @@ class BuildController extends \PHPCI\Controller
|
|||
*/
|
||||
public function delete($buildId)
|
||||
{
|
||||
if (empty($_SESSION['user']) || !$_SESSION['user']->getIsAdmin()) {
|
||||
if (empty($_SESSION['phpci_user']) || !$_SESSION['phpci_user']->getIsAdmin()) {
|
||||
throw new \Exception('You do not have permission to do that.');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ class PluginController extends \PHPCI\Controller
|
|||
|
||||
public function index()
|
||||
{
|
||||
if (!$_SESSION['user']->getIsAdmin()) {
|
||||
if (!$_SESSION['phpci_user']->getIsAdmin()) {
|
||||
throw new \Exception('You do not have permission to do that.');
|
||||
}
|
||||
|
||||
|
|
@ -67,7 +67,7 @@ class PluginController extends \PHPCI\Controller
|
|||
|
||||
public function remove()
|
||||
{
|
||||
if (!$_SESSION['user']->getIsAdmin()) {
|
||||
if (!$_SESSION['phpci_user']->getIsAdmin()) {
|
||||
throw new \Exception('You do not have permission to do that.');
|
||||
}
|
||||
|
||||
|
|
@ -88,7 +88,7 @@ class PluginController extends \PHPCI\Controller
|
|||
|
||||
public function install()
|
||||
{
|
||||
if (!$_SESSION['user']->getIsAdmin()) {
|
||||
if (!$_SESSION['phpci_user']->getIsAdmin()) {
|
||||
throw new \Exception('You do not have permission to do that.');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -108,7 +108,8 @@ class ProjectController extends \PHPCI\Controller
|
|||
throw new NotFoundException('Project with id: ' . $projectId . ' not found');
|
||||
}
|
||||
|
||||
$build = $this->buildService->createBuild($project, null, urldecode($branch), $_SESSION['user']->getEmail());
|
||||
$email = $_SESSION['phpci_user']->getEmail();
|
||||
$build = $this->buildService->createBuild($project, null, urldecode($branch), $email);
|
||||
|
||||
header('Location: '.PHPCI_URL.'build/view/' . $build->getId());
|
||||
exit;
|
||||
|
|
@ -119,7 +120,7 @@ class ProjectController extends \PHPCI\Controller
|
|||
*/
|
||||
public function delete($projectId)
|
||||
{
|
||||
if (!$_SESSION['user']->getIsAdmin()) {
|
||||
if (!$_SESSION['phpci_user']->getIsAdmin()) {
|
||||
throw new ForbiddenException('You do not have permission to do that.');
|
||||
}
|
||||
|
||||
|
|
@ -223,7 +224,7 @@ class ProjectController extends \PHPCI\Controller
|
|||
*/
|
||||
public function edit($projectId)
|
||||
{
|
||||
if (!$_SESSION['user']->getIsAdmin()) {
|
||||
if (!$_SESSION['phpci_user']->getIsAdmin()) {
|
||||
throw new ForbiddenException('You do not have permission to do that.');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ class SessionController extends \PHPCI\Controller
|
|||
$user = $this->userStore->getByEmail($this->getParam('email'));
|
||||
|
||||
if ($user && password_verify($this->getParam('password', ''), $user->getHash())) {
|
||||
$_SESSION['user_id'] = $user->getId();
|
||||
$_SESSION['phpci_user_id'] = $user->getId();
|
||||
header('Location: ' . $this->getLoginRedirect());
|
||||
die;
|
||||
} else {
|
||||
|
|
@ -84,7 +84,9 @@ class SessionController extends \PHPCI\Controller
|
|||
*/
|
||||
public function logout()
|
||||
{
|
||||
$_SESSION = array();
|
||||
unset($_SESSION['phpci_user']);
|
||||
unset($_SESSION['phpci_user_id']);
|
||||
|
||||
session_destroy();
|
||||
header('Location: ' . PHPCI_URL);
|
||||
die;
|
||||
|
|
@ -147,8 +149,8 @@ MSG;
|
|||
$hash = password_hash($this->getParam('password'), PASSWORD_DEFAULT);
|
||||
$user->setHash($hash);
|
||||
|
||||
$_SESSION['user'] = $this->userStore->save($user);
|
||||
$_SESSION['user_id'] = $user->getId();
|
||||
$_SESSION['phpci_user'] = $this->userStore->save($user);
|
||||
$_SESSION['phpci_user_id'] = $user->getId();
|
||||
|
||||
header('Location: ' . PHPCI_URL);
|
||||
die;
|
||||
|
|
@ -164,9 +166,9 @@ MSG;
|
|||
{
|
||||
$rtn = PHPCI_URL;
|
||||
|
||||
if (!empty($_SESSION['login_redirect'])) {
|
||||
$rtn .= $_SESSION['login_redirect'];
|
||||
$_SESSION['login_redirect'] = null;
|
||||
if (!empty($_SESSION['phpci_login_redirect'])) {
|
||||
$rtn .= $_SESSION['phpci_login_redirect'];
|
||||
$_SESSION['phpci_login_redirect'] = null;
|
||||
}
|
||||
|
||||
return $rtn;
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ class UserController extends Controller
|
|||
|
||||
public function profile()
|
||||
{
|
||||
$user = $_SESSION['user'];
|
||||
$user = $_SESSION['phpci_user'];
|
||||
$values = $user->getDataArray();
|
||||
|
||||
if ($this->request->getMethod() == 'POST') {
|
||||
|
|
@ -64,7 +64,7 @@ class UserController extends Controller
|
|||
$email = $this->getParam('email', null);
|
||||
$password = $this->getParam('password', null);
|
||||
|
||||
$_SESSION['user'] = $this->userService->updateUser($user, $name, $email, $password);
|
||||
$_SESSION['phpci_user'] = $this->userService->updateUser($user, $name, $email, $password);
|
||||
}
|
||||
|
||||
$form = new Form();
|
||||
|
|
@ -109,7 +109,7 @@ class UserController extends Controller
|
|||
*/
|
||||
public function add()
|
||||
{
|
||||
if (!$_SESSION['user']->getIsAdmin()) {
|
||||
if (!$_SESSION['phpci_user']->getIsAdmin()) {
|
||||
throw new ForbiddenException('You do not have permission to do that.');
|
||||
}
|
||||
|
||||
|
|
@ -151,7 +151,7 @@ class UserController extends Controller
|
|||
*/
|
||||
public function edit($userId)
|
||||
{
|
||||
if (!$_SESSION['user']->getIsAdmin()) {
|
||||
if (!$_SESSION['phpci_user']->getIsAdmin()) {
|
||||
throw new ForbiddenException('You do not have permission to do that.');
|
||||
}
|
||||
|
||||
|
|
@ -244,7 +244,7 @@ class UserController extends Controller
|
|||
*/
|
||||
public function delete($userId)
|
||||
{
|
||||
if (!$_SESSION['user']->getIsAdmin()) {
|
||||
if (!$_SESSION['phpci_user']->getIsAdmin()) {
|
||||
throw new ForbiddenException('You do not have permission to do that.');
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue