Commit 6904caef authored by Denis S. Valdenaire's avatar Denis S. Valdenaire

authentification partagée... suite et pas fin

parent ae62afb2
......@@ -14,13 +14,10 @@ include("config/config.php");
global $data;
$data = new data();
new session_saas();
global $logged_user;
$logged_user = new User(0);
if(!array_key_exists("user_id", $_SESSION)) {
if(!array_key_exists("logged_user", $_SESSION)) {
header($_SERVER['SERVER_PROTOCOL'] . ' 403 Not Authorized', true, 403);
exit();
} else {
$logged_user = User::fetch($_SESSION["user_id"]);
}
// this is a json-only zone
header("Content-Type: application/json");
......
......@@ -30,6 +30,9 @@ class AppController {
// DEBUG $this->twig->addExtension(new Twig_Extension_Debug());
$this->context["global"] = $GLOBALS;
$this->context["request"] = $_REQUEST;
// extract the local roles from the session
// application_instance id and key should be in the config file
$this->set("session", $_SESSION);
if(!method_exists($this, "_".$_REQUEST["a"])) {
......
......@@ -13,7 +13,6 @@ spl_autoload_register("myautoload");
include("config/config.php");
global $data;
$data = new data();
//$session_db = new session_db();
new session_saas();
if(!array_key_exists("logged_user", $_SESSION)) {
......@@ -55,3 +54,8 @@ $_REQUEST["i"] = (array_key_exists("i", $_REQUEST)) ? $_REQUEST["i"] : "";
// call of the controller
$controller = str_replace(' ','',ucwords(str_replace('_',' ',$_REQUEST["o"])))."Controller";
$ctrl = new $controller();
?>
<pre>
<?php
var_dump($_SESSION);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment