Change Controller to access admin
continuous-integration/drone/push Build is passing Details

master
dorian.hodin 2 years ago
parent 9b33a0207f
commit a230ceb8bb

@ -43,10 +43,11 @@ class ControllerAdmin
* Supprime une question par son id récupéré par le tableau $_POST ainsi que les possibles réponses associées
*
* @return void
* @throws Exception
*/
public function deleteQuestion(): void
{
(new ModelAdmin())->deleteQuestion();
(new ModelAdmin)->deleteQuestion();
$this->goToQuestions();
}
@ -75,10 +76,11 @@ class ControllerAdmin
* Permet de supprimer une possible réponse par son id récupéré par le tableau $_POST
*
* @return void
* @throws Exception
*/
public function deleteResponse(): void
{
(new ModelAdmin())->deleteResponse();
(new ModelAdmin)->deleteResponse();
$this->goToQuestions();
}
@ -137,10 +139,11 @@ class ControllerAdmin
* Permet de supprimer un mot clef qui sera récupéré par le tableau $_POST
*
* @return void
* @throws Exception
*/
public function deleteKeyword(): void
{
(new ModelAdmin())->deleteKeyword();
(new ModelAdmin)->deleteKeyword();
$this->goToCategories();
}
@ -152,7 +155,7 @@ class ControllerAdmin
*/
public function goToCategories(): void
{
$categories = (new ModelAdmin())->getCategories();
$categories = (new ModelAdmin)->getCategories();
global $rep, $views;
require_once($rep.$views['categories']);
}
@ -179,7 +182,7 @@ class ControllerAdmin
*/
public function goToResponses(): void
{
$responsesCandidate = (new ModelAdmin())->getResponsesCandidate();
$responsesCandidate = (new ModelAdmin)->getResponsesCandidate();
global $rep, $views;
require_once($rep.$views['responses']);
}
@ -190,9 +193,12 @@ class ControllerAdmin
require_once($rep.$views['admin']);
}
/**
* @throws Exception
*/
public function deleteResponsesCandidate(): void
{
(new ModelAdmin())->deleteResponsesCandidate();
(new ModelAdmin)->deleteResponsesCandidate();
$this->goToResponses();
}
}

@ -52,7 +52,7 @@ class FrontController
if ($match) {
$target = $match['target'];
$params = $match['params'];
if (!isset($_SESSION['role'])) {
if (!isset($_SESSION['role']) || ($_SESSION['role']!="Admin" && $_SESSION['role']!="Candidate")) {
$_SESSION['role'] = 'Candidate';
}
$role = Clean::simpleString($_SESSION['role']);

Loading…
Cancel
Save