2016-04-04 09:47:17 +00:00
|
|
|
<?php define('__ROOT__', dirname(dirname(__FILE__)) );
|
|
|
|
require_once __ROOT__.'/manager/autoloader.php';
|
2016-04-10 14:40:49 +00:00
|
|
|
use \manager\Repo;
|
2016-04-04 09:47:17 +00:00
|
|
|
use \manager\ModuleRequest;
|
|
|
|
use \manager\ManagerError;
|
|
|
|
use \manager\ResourceDispatcher;
|
2016-04-10 15:01:44 +00:00
|
|
|
use \manager\Database;
|
2016-04-10 14:40:49 +00:00
|
|
|
|
2016-04-14 14:23:08 +00:00
|
|
|
debug();
|
2016-04-10 14:40:49 +00:00
|
|
|
|
|
|
|
|
2016-04-12 13:37:17 +00:00
|
|
|
|
|
|
|
|
2016-04-14 14:23:08 +00:00
|
|
|
/* (1) Gestion des droits */
|
|
|
|
if( permission('admin') ){
|
2016-04-10 14:40:49 +00:00
|
|
|
|
2016-04-14 14:23:08 +00:00
|
|
|
/* [1] Gestion des tokens
|
|
|
|
=========================================================*/
|
|
|
|
// permission: admin
|
|
|
|
//=======================================================//
|
2016-04-04 09:47:17 +00:00
|
|
|
|
2016-04-14 14:23:08 +00:00
|
|
|
/* (2) On recupere la liste des tokens */
|
|
|
|
$req_tokens = new Repo('token/getAll');
|
|
|
|
$tokens = $req_tokens->answer();
|
2016-04-04 09:47:17 +00:00
|
|
|
|
2016-04-14 14:23:08 +00:00
|
|
|
|
|
|
|
?><section data-sublink='tokens'>
|
2016-04-10 13:33:36 +00:00
|
|
|
|
2016-04-12 13:37:17 +00:00
|
|
|
<h6 class='center'>Gestion des accès distants</h6><br>
|
|
|
|
|
|
|
|
<!-- [1] Panel d'ajout/suppression de token -->
|
|
|
|
<section data-panel-list>
|
|
|
|
<!-- Header -->
|
|
|
|
<div data-header>
|
|
|
|
<span>Gestion des accès distants</span>
|
|
|
|
<button id='add-token'>Ajouter un accès</button>
|
|
|
|
</div>
|
2016-04-10 13:33:36 +00:00
|
|
|
|
2016-04-12 13:37:17 +00:00
|
|
|
<!-- Description des tokens actifs -->
|
|
|
|
<div data-description>Liste des accès distants actifs. Ils seront automatiquement désactivés a la date d'expiration. Veuillez toutefois les supprimer.</div>
|
|
|
|
<!-- Creation d'un nouvel element (cache) -->
|
|
|
|
<div data-add>
|
2016-04-14 14:23:08 +00:00
|
|
|
<span class='label'>Nom de l'accès</span><input type='text' placeholder='token' id='add-name'><br>
|
|
|
|
<span class='label'>Duree de vie (jours)</span><input type='text' value='10' id='add-duration'><br>
|
2016-04-12 13:37:17 +00:00
|
|
|
<input type='button' value='Ajouter un accès' id='add-submit'>
|
|
|
|
</div>
|
2016-04-10 13:33:36 +00:00
|
|
|
|
2016-04-12 13:37:17 +00:00
|
|
|
<!-- Conteneur de la liste des elements -->
|
|
|
|
<ul data-list>
|
2016-04-10 13:33:36 +00:00
|
|
|
|
2016-04-12 13:37:17 +00:00
|
|
|
<!-- Elements de la liste -->
|
|
|
|
<?php
|
|
|
|
foreach($tokens as $token){
|
|
|
|
echo "<li data-element data-id='".$token['id']."'>";
|
|
|
|
// Si token actif
|
|
|
|
if( !$token['expired'] )
|
2016-04-14 14:23:08 +00:00
|
|
|
echo "<div class='active' data-token><span>actif</span></div>";
|
2016-04-12 13:37:17 +00:00
|
|
|
else
|
2016-04-14 14:23:08 +00:00
|
|
|
echo "<div data-token><span>Expiré</span></div>";
|
2016-04-10 16:50:07 +00:00
|
|
|
|
|
|
|
|
2016-04-12 13:37:17 +00:00
|
|
|
echo "<div>";
|
|
|
|
echo "<span>".$token['name']."</span>";
|
|
|
|
echo "<span data-prefix='Expiration'>".Database::frDate($token['expires'])."</span>";
|
2016-04-14 09:07:13 +00:00
|
|
|
echo "</div><div>";
|
|
|
|
echo "<span><span class='flag'>".$token['token']."</span></span>";
|
2016-04-12 13:37:17 +00:00
|
|
|
echo "</div>";
|
2016-04-10 16:50:07 +00:00
|
|
|
|
2016-04-12 13:37:17 +00:00
|
|
|
echo "<button class='remove-token'>Supprimer</button>";
|
|
|
|
echo "</li>";
|
|
|
|
}
|
|
|
|
?>
|
2016-04-10 14:40:49 +00:00
|
|
|
|
2016-04-10 13:33:36 +00:00
|
|
|
|
2016-04-10 16:27:38 +00:00
|
|
|
|
2016-04-12 13:37:17 +00:00
|
|
|
</ul>
|
2016-04-10 16:27:38 +00:00
|
|
|
|
2016-04-12 13:37:17 +00:00
|
|
|
</section>
|
2016-04-10 13:33:36 +00:00
|
|
|
</section>
|
2016-04-12 13:37:17 +00:00
|
|
|
|
2016-04-14 14:23:08 +00:00
|
|
|
<?php
|
|
|
|
/* [2] Gestion des utilisateurs
|
|
|
|
=========================================================*/
|
|
|
|
// permission: admin
|
|
|
|
//=======================================================//
|
|
|
|
|
|
|
|
/* (1) On recupere la liste des utilisateurs */
|
|
|
|
$req_users = new ModuleRequest('user/getAll');
|
|
|
|
$answer_users = $req_users->dispatch();
|
|
|
|
// Si erreur de requete
|
|
|
|
if( $answer_users->error != ManagerError::Success )
|
|
|
|
var_dump( ManagerError::explicit($answer_users->error) );
|
|
|
|
// On recupere la liste des utilisateurs
|
|
|
|
$users = $answer_users->get('users');
|
|
|
|
|
|
|
|
|
|
|
|
?><section data-sublink='users'>
|
|
|
|
<h6 class='center'>Gestion des utilisateurs</h6><br>
|
|
|
|
|
|
|
|
<!-- [1] Panel d'ajout/suppression d'utilisateur -->
|
|
|
|
<section data-panel-list>
|
|
|
|
<!-- Header -->
|
|
|
|
<div data-header>
|
|
|
|
<span>Gestion des utilisateurs</span>
|
|
|
|
<button id='add-user'>Ajouter un utilisateur</button>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<!-- Description des utilisateurs et des permissions -->
|
|
|
|
<div data-description>Liste des utilisateurs de la plateforme. Un <i>administrateur</i> peut tout faire. Un <i>sujet</i> peut compléter ses données et les consulter.</div>
|
|
|
|
<!-- Creation d'un nouvel element (cache) -->
|
|
|
|
<div data-add>
|
|
|
|
<span class='label'>Identifiant</span><input type='text' id='add-login'><br>
|
|
|
|
<span class='label'>Adresse mail</span><input type='email' id='add-mail'><br>
|
|
|
|
<span class='label'>Mot de passe</span><input type='password' id='add-password'><br>
|
|
|
|
<span class='label'>Vérification du mot de passe</span><input type='password' id='add-password2'><br>
|
|
|
|
<span class='label'>Droits</span>
|
|
|
|
<input type='checkbox' id='add-admin' id='add-admin'><label for='add-admin'>Administrateur</label>
|
|
|
|
<input type='checkbox' id='add-subject' id='add-subject'><label for='add-subject'>Sujet</label><br>
|
|
|
|
<input type='button' value='Créer un utilisateur' id='add-submit'>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<!-- Conteneur de la liste des elements -->
|
|
|
|
<ul data-list>
|
|
|
|
|
|
|
|
<!-- Elements de la liste -->
|
|
|
|
<?php
|
|
|
|
foreach($users as $user){
|
|
|
|
echo "<li data-element data-id='".$user['id_user']."'>";
|
|
|
|
// Si user actif
|
|
|
|
if( in_array('admin', $user['permission']) )
|
|
|
|
echo "<div class='active' data-user><span>Administrateur</span></div>";
|
|
|
|
else
|
|
|
|
echo "<div data-user><span>Sujet</span></div>";
|
|
|
|
|
|
|
|
|
|
|
|
echo "<div>";
|
|
|
|
echo "<span data-prefix='Identifiant'>".$user['login']."</span>";
|
|
|
|
echo "<span data-prefix='Adresse mail'>".$user['mail']."</span>";
|
|
|
|
echo "<span data-prefix='Permissions'>".implode(", ", $user['permission'])."</span>";
|
|
|
|
echo "</div>";
|
|
|
|
|
|
|
|
echo "<button class='remove-user'>Supprimer</button>";
|
|
|
|
echo "</li>";
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
</section>
|
|
|
|
</section>
|
|
|
|
|
2016-04-10 11:20:37 +00:00
|
|
|
|
2016-04-14 14:23:08 +00:00
|
|
|
<!-- FIN PERMISSION ADMIN -->
|
|
|
|
<?php } ?>
|