Merged feature/refactor_module_repo into dev
This commit is contained in:
commit
3db436d596
|
@ -2,11 +2,18 @@
|
|||
|
||||
"users": {
|
||||
"login": {
|
||||
"description": "Test de connexion avec un login (identifiant ou adresse mail) et un mot de passe.",
|
||||
"description": "Connexion avec un login (identifiant ou adresse mail) et un mot de passe.",
|
||||
"permissions": [],
|
||||
"parameters": {
|
||||
"login": { "description": "Identifiant ou adresse mail", "type": "varchar(255)" },
|
||||
"password": { "description": "Mot de passe", "type":"text" }
|
||||
}
|
||||
},
|
||||
|
||||
"logout": {
|
||||
"description": "Deconnexion",
|
||||
"permissions": [],
|
||||
"parameters": {}
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -14,6 +21,7 @@
|
|||
"call_log": {
|
||||
"unserialize": {
|
||||
"description": "Recupere le contenu d'un fichier XML de journal d'appel.",
|
||||
"permissions": ["admin"],
|
||||
"parameters": {
|
||||
"filecontent": { "description": "Contenu du fichier XML", "type": "text" }
|
||||
}
|
||||
|
@ -24,11 +32,13 @@
|
|||
|
||||
"network_data": {
|
||||
"description": "Renvoie un jeu de donnees fictif pour un graphique de type #network.",
|
||||
"permissions": ["admin"],
|
||||
"parameters": {}
|
||||
},
|
||||
|
||||
"network_render": {
|
||||
"description": "Renvoie le contenu du svg representant un graphique de type #network avec les donnees recues.",
|
||||
"permissions": ["admin"],
|
||||
"parameters": {
|
||||
"dataset": { "description": "Dataset au bon format pour un graphique de type #network." }
|
||||
}
|
||||
|
@ -40,6 +50,7 @@
|
|||
|
||||
"remove": {
|
||||
"description": "Suppression d'un token d'id donne.",
|
||||
"permissions": ["admin"],
|
||||
"parameters": {
|
||||
"token_id": { "description": "UID du token a supprimer", "type": "id" }
|
||||
}
|
||||
|
@ -48,6 +59,7 @@
|
|||
|
||||
"generate": {
|
||||
"description": "Creation d'un token de nom et de duree donnee",
|
||||
"permissions": ["admin"],
|
||||
"parameters": {
|
||||
"name": { "description": "Nom attribue au token", "type": "varchar(50)" },
|
||||
"duration": { "description": "Duree du token en nombre de jours", "type": "numeric" }
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
body{font-family:'Open Sans';font-size:15px}#WRAPPER{display:block;position:fixed;top:0;left:0;width:100%;height:100%;background-color:#e8e8e8;overflow-x:hidden;overflow-y:auto;z-index:1}#WRAPPER>#HEADER{display:block;position:fixed;top:0;left:0;width:100%;height:calc( 4em - 1px );border-bottom:1px solid #cfcfcf;background-color:#fff;z-index:9}#WRAPPER>#MENU-SIDE{display:block;position:fixed;top:4em;left:0;width:15em;height:calc( 100% - 4em );box-shadow:2px 1px 3px #ddd;background-color:#32323a;transition:all .3s;z-index:10}#WRAPPER>#CONTAINER{display:flex;position:absolute;top:4em;left:15em;width:calc( 100% - 15em - 2*1em );min-height:calc( 100% - 4em - 2*1em );padding:1em;flex-direction:row;justify-content:space-between;overflow-x:none;overflow-y:auto}#LOGIN{display:flex;position:fixed;top:0;left:-100%;width:100%;height:100%;flex-direction:row;flex-wrap:nowrap;justify-content:space-around;align-items:center;background-color:#32323a;transition:left .3s ease-in-out;z-index:101}#LOGIN.active{left:0}#LOGIN>#login-icon{width:35em;height:10em;background:url("/f/svg/icon/st") center center no-repeat;background-size:auto 100%}#LOGIN>#login-form{display:block}#LOGIN>#login-form>input[type='text'],#LOGIN>#login-form>input[type='password'],#LOGIN>#login-form>input[type='button']{display:flex;width:20em;margin:2em 0;padding:1em 2em;flex-direction:column;justify-content:space-around;flex-wrap:nowrap;align-items:middle;border-radius:5px;border:1px solid #6b6b6b;background-color:#32323a;color:#fff;transition:border .2s ease-in-out;cursor:default}#LOGIN>#login-form>input[type='text']:hover,#LOGIN>#login-form>input[type='text']:focus,#LOGIN>#login-form>input[type='password']:hover,#LOGIN>#login-form>input[type='password']:focus,#LOGIN>#login-form>input[type='button']:hover,#LOGIN>#login-form>input[type='button']:focus{border-color:#53d192}#LOGIN>#login-form>input[type='button']{margin:2em auto;border:0;background-color:#53d192;color:#fff;font-weight:bold;cursor:pointer}#LOGIN>#login-form>input[type='button']:hover{background-color:#33be79;box-shadow:0 0 1em #1a1a1f}#LOGIN>#login-form>#lost-password{color:#ddd;cursor:pointer}#LOGIN>#login-form>#lost-password:hover{color:#53d192;text-decoration:underline}#LOGIN>#login-close{display:block;position:absolute;top:2em;right:2em;width:2em;height:2em;background:url("/f/svg/close/st/container/ffffff") center center no-repeat;background-size:80%;cursor:pointer}
|
||||
body{font-family:'Open Sans';font-size:15px}#WRAPPER{display:block;position:fixed;top:0;left:0;width:100%;height:100%;background-color:#e8e8e8;overflow-x:hidden;overflow-y:auto;z-index:1}#WRAPPER>#HEADER{display:block;position:fixed;top:0;left:0;width:100%;height:calc( 4em - 1px );border-bottom:1px solid #cfcfcf;background-color:#fff;z-index:9}#WRAPPER>#MENU-SIDE{display:block;position:fixed;top:4em;left:0;width:15em;height:calc( 100% - 4em );box-shadow:2px 1px 3px #ddd;background-color:#32323a;transition:all .3s;z-index:10}#WRAPPER>#CONTAINER{display:flex;position:absolute;top:4em;left:15em;width:calc( 100% - 15em - 2*1em );min-height:calc( 100% - 4em - 2*1em );padding:1em;flex-direction:row;justify-content:space-between;overflow-x:none;overflow-y:auto}#LOGIN{display:flex;position:fixed;top:0;left:-100%;width:100%;height:100%;flex-direction:row;flex-wrap:nowrap;justify-content:space-around;align-items:center;background-color:#32323a;transition:left .3s ease-in-out;z-index:101}#LOGIN.active{left:0}#LOGIN>#login-icon{width:35em;height:10em;background:url("/f/svg/icon/st") center center no-repeat;background-size:auto 100%}#LOGIN>#login-form{display:block}#LOGIN>#login-form>input[type='text'],#LOGIN>#login-form>input[type='password'],#LOGIN>#login-form>input[type='button']{display:flex;width:20em;margin:2em 0;padding:1em 2em;flex-direction:column;justify-content:space-around;flex-wrap:nowrap;align-items:middle;border-radius:5px;border:1px solid #6b6b6b;background-color:#32323a;color:#fff;font-weight:bold;letter-spacing:.07em;transition:border .2s ease-in-out;cursor:default}#LOGIN>#login-form>input[type='text']:hover,#LOGIN>#login-form>input[type='text']:focus,#LOGIN>#login-form>input[type='password']:hover,#LOGIN>#login-form>input[type='password']:focus,#LOGIN>#login-form>input[type='button']:hover,#LOGIN>#login-form>input[type='button']:focus{border-color:#53d192}#LOGIN>#login-form>input[type='button']{margin:2em auto;border:0;background-color:#53d192;color:#fff;font-weight:bold;cursor:pointer}#LOGIN>#login-form>input[type='button']:hover{background-color:#33be79;box-shadow:0 0 1em #1a1a1f}#LOGIN>#login-form>#lost-password{color:#ddd;cursor:pointer}#LOGIN>#login-form>#lost-password:hover{color:#53d192;text-decoration:underline}#LOGIN>#login-close{display:block;position:absolute;top:2em;right:2em;min-width:2em;height:2em;background:url("/f/svg/back/st/container/ffffff") right center no-repeat;background-size:1em;color:#fff;padding-right:2em;line-height:2em;font-weight:bold;cursor:pointer}
|
||||
/*# sourceMappingURL=layout.css.map */
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"version": 3,
|
||||
"mappings": "AAEA,IAAI,CAEH,WAAW,CAAE,WAAW,CACxB,SAAS,CAAE,IAAI,CAKhB,QAAQ,CACP,OAAO,CAAE,KAAK,CACd,QAAQ,CAAE,KAAK,CACd,GAAG,CAAE,CAAC,CACN,IAAI,CAAE,CAAC,CACP,KAAK,CAAE,IAAI,CACX,MAAM,CAAE,IAAI,CAEb,gBAAgB,CCfE,OAAO,CDiBzB,UAAU,CAAE,MAAM,CAClB,UAAU,CAAE,IAAI,CAEhB,OAAO,CAAE,CAAC,CAKV,gBAAW,CACV,OAAO,CAAE,KAAK,CACd,QAAQ,CAAE,KAAK,CACd,GAAG,CAAE,CAAC,CACN,IAAI,CAAE,CAAC,CACP,KAAK,CAAE,IAAI,CACX,MAAM,CAAE,iBAA+B,CAExC,aAAa,CAAE,iBAA+B,CAE9C,gBAAgB,CClCC,IAAO,CDoCxB,OAAO,CAAE,CAAC,CAQX,mBAAc,CACb,OAAO,CAAE,KAAK,CACd,QAAQ,CAAE,KAAK,CACd,GAAG,CChCY,GAAG,CDiClB,IAAI,CAAE,CAAC,CACP,KAAK,CCnC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ACb,OAAO,CAAE,OAAO,CAGhB,cAAc,CAAE,MAAM,CACtB,eAAe,CAAE,YAAY,CAC7B,SAAS,CAAE,MAAM,CACjB,WAAW,CAAE,MAAM,CAGnB,aAAa,CAAE,GAAG,CAClB,MAAM,CAAE,iBAAgC,CAExC,gBAAgB,CClJD,OAAO,CDoJtB,KAAK,CCjJU,IAAO,CDkJtB,WAAW,CAAE,IAAI,CACjB,cAAc,CAAE,KAAK,CAErB,UAAU,CAAE,sBAAsB,CAElC,MAAM,CAAE,OAAO,CAGf,mRACO,CACN,YAAY,CClKG,OAAO,CDyKxB,uCAAwB,CACvB,MAAM,CAAE,QAAQ,CAEhB,MAAM,CAAE,CAAC,CAET,gBAAgB,CC9KA,OAAO,CDgLvB,KAAK,CC1KU,IAAO,CD2KtB,WAAW,CAAE,IAAI,CAEjB,MAAM,CAAE,OAAO,CAGf,6CAAO,CACN,gBAAgB,CAAE,OAA6B,CAC/C,UAAU,CAAE,eAA4B,CAU1C,iCAAkB,CACjB,KAAK,CC9LU,IAAO,CDgMtB,MAAM,CAAE,OAAO,CAGf,uCAAO,CACN,KAAK,CCzMU,OAAO,CD0MtB,eAAe,CAAE,SAAS,CAO7B,mBAAgB,CACf,OAAO,CAAE,KAAK,CACd,QAAQ,CAAE,QAAQ,CACjB,GAAG,CAAE,GAAG,CACR,KAAK,CAAE,GAAG,CACV,SAAS,CAAE,GAAG,CACd,MAAM,CAAE,GAAG,CAEZ,UAAU,CAAE,6DAA6D,CACzE,eAAe,CAAE,GAAG,CAEpB,KAAK,CAAE,IAAI,CACX,aAAa,CAAE,GAAG,CAClB,WAAW,CAAE,GAAG,CAChB,WAAW,CAAE,IAAI,CAEjB,MAAM,CAAE,OAAO",
|
||||
"sources": ["layout.scss","constants.scss"],
|
||||
"names": [],
|
||||
"file": "layout.css"
|
||||
|
|
|
@ -156,6 +156,8 @@ body{
|
|||
background-color: $dark-bg;
|
||||
|
||||
color: $dark-fg-primary;
|
||||
font-weight: bold;
|
||||
letter-spacing: .07em;
|
||||
|
||||
transition: border .2s ease-in-out;
|
||||
|
||||
|
@ -216,11 +218,16 @@ body{
|
|||
position: absolute;
|
||||
top: 2em;
|
||||
right: 2em;
|
||||
width: 2em;
|
||||
min-width: 2em;
|
||||
height: 2em;
|
||||
|
||||
background: url('/f/svg/close/st/container/ffffff') center center no-repeat;
|
||||
background-size: 80%;
|
||||
background: url('/f/svg/back/st/container/ffffff') right center no-repeat;
|
||||
background-size: 1em;
|
||||
|
||||
color: #fff;
|
||||
padding-right: 2em;
|
||||
line-height: 2em;
|
||||
font-weight: bold;
|
||||
|
||||
cursor: pointer;
|
||||
}
|
||||
|
|
|
@ -207,14 +207,35 @@
|
|||
var LOGIN = {
|
||||
show: document.getElementById('user-data'),
|
||||
hide: document.getElementById('login-close'),
|
||||
page: document.getElementById('LOGIN')
|
||||
page: document.getElementById('LOGIN'),
|
||||
|
||||
login: document.getElementById('login-login'),
|
||||
password: document.getElementById('login-password'),
|
||||
submit: document.getElementById('login-submit')
|
||||
};
|
||||
|
||||
// Ouverture de la page de login
|
||||
/* (1) Gestion de l'affichage de la page de login */
|
||||
LOGIN.show.addEventListener('click', function(e){ LOGIN.page.className = 'active'; }, false);
|
||||
|
||||
// Fermeture de la page de login
|
||||
/* (2) Gestion de la fermeture de la page de login */
|
||||
LOGIN.hide.addEventListener('click', function(e){ LOGIN.page.className = ''; }, false);
|
||||
|
||||
/* (3) Gestion du login */
|
||||
LOGIN.submit.addEventListener('click', function(e){
|
||||
// Creation de la requete de connexion
|
||||
var request = {
|
||||
path: 'users/login',
|
||||
login: LOGIN.login.value,
|
||||
password: LOGIN.password.value
|
||||
};
|
||||
|
||||
// On lance la requete et recupere la reponse
|
||||
api.send(request, function(answer){
|
||||
console.log( answer );
|
||||
if( answer.ModuleError == 0 ) // Si on est bien connecte, on recharge la page
|
||||
document.location = '/';
|
||||
}, js_access_token);
|
||||
|
||||
}, false);
|
||||
|
||||
// }
|
|
@ -64,6 +64,8 @@
|
|||
// Token inexistant ou faux
|
||||
const TokenError = 15;
|
||||
|
||||
const PermissionError = 16;
|
||||
|
||||
|
||||
/* EXPLICITE UN CODE D'ERREUR
|
||||
*
|
||||
|
@ -95,6 +97,7 @@
|
|||
case self::PDOConnection: return "La connexion avec la base de donnees a echoue"; break;
|
||||
|
||||
case self::TokenError: return "Le token de connection est absent ou errone"; break;
|
||||
case self::PermissionError: return "Vous n'avez pas la permission d'effectuer cette action"; break;
|
||||
|
||||
// default: return "Erreur inconnue..."; break;
|
||||
}
|
||||
|
|
|
@ -3,16 +3,6 @@
|
|||
namespace manager;
|
||||
use \manager\Database;
|
||||
|
||||
// FORMAT:
|
||||
//
|
||||
// path: "nomModule/nomMethode"
|
||||
// data1: {donnee1}
|
||||
// data2: {donnee2}
|
||||
// ...
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
class ModuleRequest{
|
||||
|
||||
|
@ -80,14 +70,23 @@
|
|||
if( !$this->checkPath($path) ) // Verification de la coherence du chemin + attribution
|
||||
return false;
|
||||
|
||||
/* [3] Verification des parametres (si @type est defini)
|
||||
|
||||
/* [3] Verification des droits
|
||||
=========================================================*/
|
||||
if( !$this->checkPermission() ){ // Si on a pas les droits
|
||||
$this->error = ManagerError::PermissionError;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/* [4] Verification des parametres (si @type est defini)
|
||||
=========================================================*/
|
||||
if( !$this->checkParams($params) ){ // Verification de tous les types
|
||||
$this->error = ManagerError::ParamError;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* [4] Construction de l'objet
|
||||
/* [5] Construction de l'objet
|
||||
=========================================================*/
|
||||
$this->params = $params;
|
||||
$this->error = ManagerError::Success;
|
||||
|
@ -265,6 +264,37 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
/* RETOURNE SI ON A LA PERMISSION D'EXECUTER CETTE METHODE
|
||||
*
|
||||
* @return permission<bool> Retourne si on a les droits ou pas pour executer cette methode
|
||||
*
|
||||
*/
|
||||
private function checkPermission(){
|
||||
// On recupere le nom de la methode
|
||||
$method = $this->modules[$this->path['module']][$this->path['method']];
|
||||
|
||||
// Si aucune permission n'est definie
|
||||
if( !isset($method['permissions']) ) return true;
|
||||
|
||||
// On recupere les permissions
|
||||
$permissions = $method['permissions'];
|
||||
|
||||
// Si aucune permission n'est definie, on laisse l'acces
|
||||
if( count($permissions) == 0 ) return true;
|
||||
|
||||
// On verifie qu'il y a au moins une permission ok
|
||||
foreach($permissions as $permission)
|
||||
if( permission($permission) ) return true;
|
||||
|
||||
// On retourne FAUX si aucun droit n'a ete trouve
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* VERIFICATION DU TYPE DES PARAMETRES ENVOYES
|
||||
*
|
||||
* @params<Array> Tableau associatif contenant les parametres
|
||||
|
|
|
@ -21,21 +21,41 @@
|
|||
/* [1] On verifie les logins
|
||||
=========================================================*/
|
||||
$check = new Repo('users/login', array($login, $password));
|
||||
$success = $check->answer();
|
||||
$user = $check->answer();
|
||||
|
||||
// Si le login/password est incorrect, on retourne une erreur
|
||||
if( $success === false ) return array('ModuleError' => ManagerError::ModuleError);
|
||||
if( $user === false ) return array('ModuleError' => ManagerError::ModuleError);
|
||||
|
||||
|
||||
/* [2] Si les logins sont ok, on retourne l'id de l'utilisateur
|
||||
/* [2] Gestion du login
|
||||
=========================================================*/
|
||||
$_SESSION['userid'] = $user['id_user'];
|
||||
$_SESSION['username'] = $user['login'];
|
||||
$_SESSION['permission'] = explode( ',', str_replace(' ', '', $user['permission']) );
|
||||
|
||||
/* [4] Retour de l'id user
|
||||
=========================================================*/
|
||||
|
||||
return array(
|
||||
'ModuleError' => ManagerError::Success,
|
||||
'id_user' => $success
|
||||
'id_user' => $user['id_user']
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* DECONNEXION D'UN UTILISATEUR
|
||||
*
|
||||
*/
|
||||
public static function logout(){
|
||||
$_SESSION['userid'] = null;
|
||||
$_SESSION['username'] = null;
|
||||
$_SESSION['permission'] = array();
|
||||
}
|
||||
|
||||
// [x] "login",
|
||||
// [x] "logout",
|
||||
// [ ] "getById",
|
||||
// [ ] "getAll",
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
/* [1] On verifie son login/password dans la BDD
|
||||
=========================================================*/
|
||||
$check = Database::getPDO()->prepare("SELECT id_user
|
||||
$check = Database::getPDO()->prepare("SELECT id_user, login, permission
|
||||
FROM users
|
||||
WHERE ( login = :username OR mail = :mail ) AND password = :password");
|
||||
$check->execute(array(
|
||||
|
@ -43,7 +43,7 @@
|
|||
|
||||
|
||||
// On retourne le resultat
|
||||
return (int) $result['id_user'];
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
enable-background="new 0 0 96 96"
|
||||
height="32"
|
||||
id="arrow_right"
|
||||
version="1.1"
|
||||
viewBox="0 0 32 32"
|
||||
width="32"
|
||||
xml:space="preserve"
|
||||
inkscape:version="0.91 r13725"
|
||||
sodipodi:docname="back.svg"><metadata
|
||||
id="metadata4522"><rdf:RDF><cc:Work
|
||||
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
|
||||
id="defs4520" /><sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1056"
|
||||
id="namedview4518"
|
||||
showgrid="false"
|
||||
fit-margin-top="0"
|
||||
fit-margin-left="0"
|
||||
fit-margin-right="0"
|
||||
fit-margin-bottom="0"
|
||||
inkscape:snap-page="true"
|
||||
inkscape:zoom="14.053747"
|
||||
inkscape:cx="22.265424"
|
||||
inkscape:cy="14.705036"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="24"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="arrow_right" /><path
|
||||
d="m 1.6,17.600025 24.9376,0 -8.5824,8.5824 c -0.6248,0.6248 -0.6248,1.638 -4e-4,2.2624 0.6248,0.6248 1.6384,0.6248 2.2632,0 l 11.3132,-11.3136 0,0 c 0.0744,-0.0744 0.1408,-0.1564 0.1992,-0.2436 0.0268,-0.0404 0.0456,-0.084 0.0688,-0.126 0.0264,-0.0496 0.0568,-0.0968 0.078,-0.1492 0.0228,-0.054 0.0356,-0.11 0.0516,-0.166 0.0132,-0.0444 0.0304,-0.0868 0.0396,-0.1324 0.0208,-0.104 0.0316,-0.2088 0.0316,-0.314 l 0,0 c 0,-0.0012 -4e-4,-0.0024 -4e-4,-0.0036 -4e-4,-0.1036 -0.0108,-0.2076 -0.0312,-0.3096 -0.0096,-0.048 -0.0276,-0.0924 -0.0416,-0.1396 -0.0156,-0.0532 -0.0276,-0.1072 -0.0492,-0.1588 -0.0232,-0.0556 -0.0544,-0.106 -0.0832,-0.1584 -0.0216,-0.0392 -0.0388,-0.0792 -0.0636,-0.1168 -0.0584,-0.0884 -0.1256,-0.1708 -0.2004,-0.2456 L 20.2176,3.5552251 c -0.6248,-0.6248 -1.638,-0.6248 -2.2628,-4e-4 -0.6248,0.6248 -0.6248,1.638 0,2.2632 l 8.5824,8.5819999 -24.9372,0 c -0.8836,0 -1.6,0.7164 -1.6,1.6 0,0.8836 0.7164,1.6 1.6,1.6 z"
|
||||
id="stylisable"
|
||||
inkscape:connector-curvature="0" /></svg>
|
After Width: | Height: | Size: 2.6 KiB |
31
view.php
31
view.php
|
@ -43,14 +43,15 @@
|
|||
<!-- LOGIN -->
|
||||
<?php if( connected() ) echo "<div id='LOGIN'>";
|
||||
else echo "<div id='LOGIN' class='active'>"; ?>
|
||||
|
||||
|
||||
|
||||
<div id='login-icon'></div>
|
||||
<span id='login-close'></span>
|
||||
<div id='login-close'>Accéder à la plateforme</div>
|
||||
|
||||
<div id='login-form'>
|
||||
<input type='text' placeholder='Identifiant ou adresse mail' id='login-login'>
|
||||
<input type='password' placeholder='Mot de passe' id='login-password'>
|
||||
<input type='button' value='Connexion' id='login-submit'>
|
||||
<input type='text' placeholder='Identifiant ou adresse mail' id='login-login'>
|
||||
<input type='password' placeholder='Mot de passe' id='login-password'>
|
||||
<input type='button' value='Connexion' id='login-submit'>
|
||||
|
||||
<span id='lost-password'>Mot de passe oublié ?</span>
|
||||
</div>
|
||||
|
@ -90,19 +91,23 @@
|
|||
|
||||
<span data-link='input' ><?= ResourceDispatcher::getResource('f/svg/input/st/menu-side'); ?>Acquisition</span>
|
||||
<div class='sub'>
|
||||
<span data-sublink='q'>Questionnaire</span>
|
||||
<span data-sublink='fb'>Facebook</span>
|
||||
<span data-sublink='tel'>Journal telephonique</span>
|
||||
<span data-sublink='survey'>Questionnaire</span>
|
||||
<span data-sublink='facebook'>Facebook</span>
|
||||
<span data-sublink='telephone'>Journal telephonique</span>
|
||||
</div>
|
||||
|
||||
<span data-link='analytics' ><?= ResourceDispatcher::getResource('f/svg/analytics/st/menu-side'); ?>Statistiques</span>
|
||||
<span data-link='charts' class='sep'><?= ResourceDispatcher::getResource('f/svg/charts/st/menu-side'); ?>Visualisation</span>
|
||||
|
||||
<span data-link='settings' ><?= ResourceDispatcher::getResource('f/svg/settings/st/menu-side' ); ?>Paramètres</span>
|
||||
<div class='sub'>
|
||||
<span data-sublink='tokens'>Gestion des tokens</span>
|
||||
<span data-sublink='users'>Gestion des utilisateurs</span>
|
||||
</div>
|
||||
<?php if( permission('admin') ){ ?>
|
||||
|
||||
<span data-link='settings' ><?= ResourceDispatcher::getResource('f/svg/settings/st/menu-side' ); ?>Paramètres</span>
|
||||
<div class='sub'>
|
||||
<span data-sublink='tokens'>Gestion des tokens</span>
|
||||
<span data-sublink='users'>Gestion des utilisateurs</span>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ $data = $answer->get('data');
|
|||
|
||||
|
||||
/* (2) On recupere le rendu */
|
||||
$getRender = new ModuleRequest('charts/network_render', array($data));
|
||||
$getRender = new ModuleRequest('charts/network_render', array('dataset' => $data));
|
||||
$answer = $getRender->dispatch();
|
||||
|
||||
// Si pas d'erreur
|
||||
|
|
|
@ -8,66 +8,74 @@
|
|||
|
||||
|
||||
|
||||
/* [1] On recupere les tokens
|
||||
|
||||
/* [1] Gestion des tokens
|
||||
=========================================================*/
|
||||
// permission: admin
|
||||
//=======================================================//
|
||||
|
||||
/* (1) On recupere la liste des tokens */
|
||||
$req_tokens = new Repo('token/getAll');
|
||||
$tokens = $req_tokens->answer();
|
||||
|
||||
?>
|
||||
|
||||
/* (2) Gestion des droits */
|
||||
if( permission('admin') ){ ?>
|
||||
|
||||
<section data-sublink='tokens'>
|
||||
|
||||
<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>
|
||||
|
||||
<!-- 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>
|
||||
<label for='add-name'>Nom de l'accès</label><br><input type='text' placeholder='token' id='add-name'><br>
|
||||
<label for='add-duration'>Duree de vie (jours)</label><br><input type='text' value='10' id='add-duration'><br>
|
||||
<input type='button' value='Ajouter un accès' id='add-submit'>
|
||||
</div>
|
||||
|
||||
<!-- Conteneur de la liste des elements -->
|
||||
<ul data-list>
|
||||
|
||||
<!-- Elements de la liste -->
|
||||
<?php
|
||||
foreach($tokens as $token){
|
||||
echo "<li data-element data-id='".$token['id']."'>";
|
||||
// Si token actif
|
||||
if( !$token['expired'] )
|
||||
echo "<div class='active'><span>actif</span></div>";
|
||||
else
|
||||
echo "<div><span>Expiré</span></div>";
|
||||
|
||||
|
||||
<section data-sublink='tokens'>
|
||||
echo "<div>";
|
||||
echo "<span>".$token['name']."</span>";
|
||||
echo "<span data-prefix='Expiration'>".Database::frDate($token['expires'])."</span>";
|
||||
echo "<span data-prefix='Token'>".$token['token']."</span>";
|
||||
echo "</div>";
|
||||
|
||||
<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>
|
||||
|
||||
<!-- 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>
|
||||
<label for='add-name'>Nom de l'accès</label><br><input type='text' placeholder='token' id='add-name'><br>
|
||||
<label for='add-duration'>Duree de vie (jours)</label><br><input type='text' value='10' id='add-duration'><br>
|
||||
<input type='button' value='Ajouter un accès' id='add-submit'>
|
||||
</div>
|
||||
|
||||
<!-- Conteneur de la liste des elements -->
|
||||
<ul data-list>
|
||||
|
||||
<!-- Elements de la liste -->
|
||||
<?php
|
||||
foreach($tokens as $token){
|
||||
echo "<li data-element data-id='".$token['id']."'>";
|
||||
// Si token actif
|
||||
if( !$token['expired'] )
|
||||
echo "<div class='active'><span>actif</span></div>";
|
||||
else
|
||||
echo "<div><span>Expiré</span></div>";
|
||||
|
||||
|
||||
echo "<div>";
|
||||
echo "<span>".$token['name']."</span>";
|
||||
echo "<span data-prefix='Expiration'>".Database::frDate($token['expires'])."</span>";
|
||||
echo "<span data-prefix='Token'>".$token['token']."</span>";
|
||||
echo "</div>";
|
||||
|
||||
echo "<button class='remove-token'>Supprimer</button>";
|
||||
echo "</li>";
|
||||
}
|
||||
?>
|
||||
echo "<button class='remove-token'>Supprimer</button>";
|
||||
echo "</li>";
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
</ul>
|
||||
|
||||
</section>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<section data-sublink='users'>
|
||||
Gestion des utilisateurs
|
||||
|
|
Loading…
Reference in New Issue