WIP
continuous-integration/drone/push Build is passing Details

pull/17/head
DahmaneYanis 1 year ago
parent 61a6b5afd5
commit 5314c3bd2d

@ -6,7 +6,6 @@ require "../sql/database.php";
require "utils.php";
require "../src/react-display.php";
use App\Connexion;
use App\Controller\FrontController;
use App\Controller\EditorController;
@ -21,16 +20,19 @@ use App\Validation\ValidationFail;
use App\Controller\ErrorController;
session_start();
$basePath = get_public_path();
var_dump($basePath);
$con = new Connexion(get_database());
global $dictActionRole;
$dictActionRole = [
"UserController" => "public",
"EditionUserController" => "editor"
"EditionUserController" => "public"
];
$frontController = new FrontController($con, $basePath, $dictActionRole);
$frontController->run();
$dict = [
"new";
]
$frontController = new FrontController($con, $basePath, $dictActionRole);
$frontController->run();

@ -41,11 +41,12 @@ class FrontController{
$match = $this->router->match();
if ($this->validMatch($match)){
$this->roleControl($match['target']);
var_dump($match);
$this->controlRoute($match['target']);
} else {
$this->displayByViewKind(ViewHttpResponse::twig("error.html.twig", [], HttpCodes::NOT_FOUND));
}
// $this->roleControl($match["target"]);
// $this->controlRoute($match["target"]);
// $this->handleByResponseType($this->matchRoute());
}
@ -86,23 +87,15 @@ class FrontController{
*
* @return ViewHttpResponse
*/
private function roleControl(string $actionController){
private function controlRoute(string $tag){
if (isset($_SESSION['role'])){
if($_SESSION['role'] = $this->dictControllerRole[$actionController]){
echo "Là on redirige vers le bon controller";
if($_SESSION['role'] = $this->dictControllerRole[$tag]){
$controller = new $tag();
}
}
else {
$_SESSION['role']
echo "session initialisé";
$_SESSION['role'] = 'public'; // Remplacer par appel de la méthode de connexion
}
// // Page not found
// if ($match == null) {
@ -117,7 +110,9 @@ class FrontController{
}
private function controlRole($match){
}
/**
* Redirect the return of the response by the response's type
*

Loading…
Cancel
Save