[bowdel] + [AuthSystemDefault] + [module.cas] DELETE (now logout works + login + session departE?E?E?E?E?ment data)

This commit is contained in:
xdrm-brackets 2018-03-15 13:13:35 +01:00
parent a5f68b2021
commit 688b0c10c8
5 changed files with 15 additions and 16 deletions

View File

@ -23,8 +23,9 @@
/* (1) Init session variables
---------------------------------------------------------*/
if( !isset($_SESSION['CAS']) || !is_array($_SESSION['CAS']) ) $_SESSION['CAS'] = [];
if( !isset($_SESSION['AUTH']) || !is_array($_SESSION['AUTH']) ) $_SESSION['AUTH'] = [];
if( !isset($_SESSION['CAS']) || !is_array($_SESSION['CAS']) ) $_SESSION['CAS'] = [];
if( !isset($_SESSION['AUTH']) || !is_array($_SESSION['AUTH']) ) $_SESSION['AUTH'] = [];
if( !isset($_SESSION['AvailableDepartment']) || !is_array($_SESSION['AvailableDepartment']) ) $_SESSION['AvailableDepartment'] = [];
/* (2) Check CAS
@ -38,8 +39,8 @@
/* (2) Get professor with this login */
$deps = $prof_repo->getLinkedDepartment($_SESSION['CAS']['login']);
if(is_array($deps)){
$_SESSION["AvailableDepartment"] = $deps;
$_SESSION['CurrentDatabase'] = $deps[0]["dbName"];
$_SESSION["AvailableDepartment"] = $deps;
$_SESSION['CurrentDatabase'] = $deps[0]["dbName"];
$_SESSION['CurrentDepartementId'] = $deps[0]["idDep"];
Repo::switchDatabase($_SESSION['CurrentDatabase']);

View File

@ -122,14 +122,10 @@ class casController{
public function delete(){
/* (1) Remove CAS credentials */
$_SESSION['CAS'] = [];
/* (2) Re-process AuthSystemDefault */
new \api\core\AuthSystemDefault();
\session_destroy();
/* (3) Return if logged out */
return ['logged_out' => !in_array('cas_user', $_SESSION['AUTH'])];
return ['logged_out' => true];
}

View File

@ -28,8 +28,10 @@
echo "window._SERVER = ".json_encode([
'session' => [
'name' => $_SESSION['NAME'],
'connected' => isset($_SESSION['AUTH']) ? count($_SESSION['AUTH']) > 0 : false
'name' => $_SESSION['CAS']['login'],
'connected' => isset($_SESSION['AUTH']) ? count($_SESSION['AUTH']) > 0 : false,
'departments' => array_map(function($d){ return [ 'id' => $d['idDep'], 'label' => $d['labelDep']]; }, $_SESSION['AvailableDepartment']),
'department_id' => $_SESSION['CurrentDepartementId']
]
])."\n";

View File

@ -7,14 +7,14 @@
<!-- <button @click='gstore.nav_out($router)'>Retour</button> -->
<!-- FILTERS -->
<!-- <section class='filter'>
<section class='filter'>
<div>Type</div>
<div>enseignant</div>
<div>volume horaire</div>
<div>formations</div>
</section> -->
<section class='filter'></section>
</section>
<!-- COURS -->
<section

View File

@ -62,7 +62,7 @@
/* (2) Filter */
& > section.filter{
padding-bottom: 0;
// padding-bottom: 0;
background-color: transparent;