Gestion complète config du module
This commit is contained in:
parent
a1f7200614
commit
999a3f4f22
|
@ -19,143 +19,8 @@
|
||||||
"edit",
|
"edit",
|
||||||
|
|
||||||
"delete"
|
"delete"
|
||||||
]
|
],
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
"userDefault": {
|
|
||||||
"create": {
|
|
||||||
"description": "blablabla",
|
|
||||||
"permissions": [],
|
|
||||||
"parameters": {
|
|
||||||
"code": { "description": "Code RFID de l'utilisateur.", "type": "rfid" },
|
|
||||||
"username": { "description": "Identifiant de l'utilisateur.", "type": "varchar(1,30)" },
|
|
||||||
"firstname": { "description": "Prénom de l'utilisateur.", "type": "varchar(3,30)" },
|
|
||||||
"lastname": { "description": "Nom de l'utilisateur.", "type": "varchar(3,30)" },
|
|
||||||
"mail": { "description": "Adresse mail de l'utilisateur.", "type": "mail" },
|
|
||||||
"password": { "description": "Mot de passe de l'utilisateur.", "type": "text" },
|
|
||||||
"status": { "description": "Status de l'utilisateur.", "type": "status" }
|
|
||||||
},
|
|
||||||
"output": {
|
|
||||||
"id_user": { "description": "UID de l'utilisateur créé.", "type": "id" },
|
|
||||||
"id_group": { "description": "UID du groupe de l'utilisateur.", "type": "id" }
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
"link": {
|
|
||||||
"description": "blablabla",
|
|
||||||
"permissions": [],
|
|
||||||
"parameters": {
|
|
||||||
|
|
||||||
},
|
|
||||||
"output": {
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
"unlink": {
|
|
||||||
"description": "blablabla",
|
|
||||||
"permissions": [],
|
|
||||||
"parameters": {
|
|
||||||
|
|
||||||
},
|
|
||||||
"output": {
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
"search": {
|
|
||||||
"description": "blablabla",
|
|
||||||
"permissions": [],
|
|
||||||
"parameters": {
|
|
||||||
|
|
||||||
},
|
|
||||||
"output": {
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
"getAll": {
|
|
||||||
"description": "blablabla",
|
|
||||||
"permissions": [],
|
|
||||||
"parameters": {
|
|
||||||
|
|
||||||
},
|
|
||||||
"output": {
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
"getById": {
|
|
||||||
"description": "blablabla",
|
|
||||||
"permissions": [],
|
|
||||||
"parameters": {
|
|
||||||
|
|
||||||
},
|
|
||||||
"output": {
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
"getByCode": {
|
|
||||||
"description": "blablabla",
|
|
||||||
"permissions": [],
|
|
||||||
"parameters": {
|
|
||||||
|
|
||||||
},
|
|
||||||
"output": {
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
"getByUsername": {
|
|
||||||
"description": "blablabla",
|
|
||||||
"permissions": [],
|
|
||||||
"parameters": {
|
|
||||||
|
|
||||||
},
|
|
||||||
"output": {
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
"getClusters": {
|
|
||||||
"description": "blablabla",
|
|
||||||
"permissions": [],
|
|
||||||
"parameters": {
|
|
||||||
|
|
||||||
},
|
|
||||||
"output": {
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
"edit": {
|
|
||||||
"description": "blablabla",
|
|
||||||
"permissions": [],
|
|
||||||
"parameters": {
|
|
||||||
|
|
||||||
},
|
|
||||||
"output": {
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
"delete": {
|
|
||||||
"description": "blablabla",
|
|
||||||
"permissions": [],
|
|
||||||
"parameters": {
|
|
||||||
|
|
||||||
},
|
|
||||||
"output": {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
"module": {
|
"module": {
|
||||||
"method": {
|
"method": {
|
||||||
|
@ -242,5 +107,155 @@
|
||||||
"all": { "description": "Si vaut TRUE, renvoie tous les sujets enregistrés.", "type": "boolean", "optional": true }
|
"all": { "description": "Si vaut TRUE, renvoie tous les sujets enregistrés.", "type": "boolean", "optional": true }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
"userDefault": {
|
||||||
|
|
||||||
|
"create": {
|
||||||
|
"description": "Création d'un nouvel utilisateur.",
|
||||||
|
"permissions": [],
|
||||||
|
"parameters": {
|
||||||
|
"code": { "description": "Code RFID de l'utilisateur.", "type": "rfid" },
|
||||||
|
"username": { "description": "Identifiant de l'utilisateur.", "type": "varchar(1,30,alphanumeric)" },
|
||||||
|
"firstname": { "description": "Prénom de l'utilisateur.", "type": "varchar(3,30,letters)" },
|
||||||
|
"lastname": { "description": "Nom de l'utilisateur.", "type": "varchar(3,30,letters)" },
|
||||||
|
"mail": { "description": "Adresse mail de l'utilisateur.", "type": "mail" },
|
||||||
|
"password": { "description": "Mot de passe de l'utilisateur.", "type": "text" },
|
||||||
|
"status": { "description": "Status de l'utilisateur.", "type": "status" }
|
||||||
|
},
|
||||||
|
"output": {
|
||||||
|
"id_user": { "description": "UID de l'utilisateur créé.", "type": "id" },
|
||||||
|
"id_group": { "description": "UID du groupe de l'utilisateur.", "type": "id" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
"link": {
|
||||||
|
"description": "Ajout d'un utilisateur à un groupe.",
|
||||||
|
"permissions": [],
|
||||||
|
"parameters": {
|
||||||
|
"id_cluster": { "description": "UID du groupe auquel rattacher.", "type": "id" },
|
||||||
|
"id_user": { "description": "UID de l'utilisateur à rattacher.", "type": "id" }
|
||||||
|
},
|
||||||
|
"output": {}
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
"unlink": {
|
||||||
|
"description": "Retrait d'un utilisateur d'un groupe",
|
||||||
|
"permissions": [],
|
||||||
|
"parameters": {
|
||||||
|
"id_cluster": { "description": "UID du groupe auquel détacher.", "type": "id" },
|
||||||
|
"id_user": { "description": "UID de l'utilisateur à détacher.", "type": "id" }
|
||||||
|
},
|
||||||
|
"output": {
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
"search": {
|
||||||
|
"description": "Recherche d'un utilisateur par mots-clés.",
|
||||||
|
"permissions": [],
|
||||||
|
"parameters": {
|
||||||
|
"keywords": { "description": "Mots-clés de la recherche.", "type": "text" }
|
||||||
|
},
|
||||||
|
"output": {
|
||||||
|
"users": { "description": "Liste des utilisateurs correspondants aux mots-clés.", "type": "array<mixed>" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
"getAll": {
|
||||||
|
"description": "Liste de tous les utilisateurs",
|
||||||
|
"permissions": [],
|
||||||
|
"parameters": {},
|
||||||
|
"output": {
|
||||||
|
"users": { "description": "Liste de tous les utilisateurs.", "type": "array<array<mixed>>" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
"getById": {
|
||||||
|
"description": "Retourne un utilisateur spécifique.",
|
||||||
|
"permissions": [],
|
||||||
|
"parameters": {
|
||||||
|
"id_user": { "description": "UID de l'utilisateur.", "type": "id" }
|
||||||
|
},
|
||||||
|
"output": {
|
||||||
|
"user": { "description": "Données de l'utilisateur.", "type": "array<mixed>" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
"getByCode": {
|
||||||
|
"description": "Retourne un utilisateur de Code RFID donné.",
|
||||||
|
"permissions": [],
|
||||||
|
"parameters": {
|
||||||
|
"code": { "description": "Code RFID de l'utilisateur.", "type": "rfid" }
|
||||||
|
},
|
||||||
|
"output": {
|
||||||
|
"user": { "description": "Données de l'utilisateur.", "type": "array<mixed>" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
"getByUsername": {
|
||||||
|
"description": "Retourne un utilisateur d'identifiant donné.",
|
||||||
|
"permissions": [],
|
||||||
|
"parameters": {
|
||||||
|
"username": { "description": "Identifiant de l'utilisateur.", "type": "varchar(1,30,alphanumeric)" }
|
||||||
|
},
|
||||||
|
"output": {
|
||||||
|
"user": { "description": "Données de l'utilisateur.", "type": "array<mixed>" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
"getClusters": {
|
||||||
|
"description": "Retourne les groupes d'un utilisateur.",
|
||||||
|
"permissions": [],
|
||||||
|
"parameters": {
|
||||||
|
"id_user": { "description": "UID de l'utilisateur.", "type": "id" }
|
||||||
|
},
|
||||||
|
"output": {
|
||||||
|
"clusters": { "description": "Liste des groupes de l'utilisateur.", "type": "array<array<mixed>>" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
"edit": {
|
||||||
|
"description": "Modifie les attributs d'un utilisateur.",
|
||||||
|
"permissions": [],
|
||||||
|
"parameters": {
|
||||||
|
"id_user": { "description": "UID de l'utilisateur.", "type": "id" },
|
||||||
|
"code": { "description": "Code RFID de l'utilisateur.", "type": "rfid", "optional": true },
|
||||||
|
"username": { "description": "Identifiant de l'utilisateur.", "type": "varchar(1,30,alphanumeric)", "optional": true },
|
||||||
|
"firstname": { "description": "Prénom de l'utilisateur.", "type": "varchar(3,30,letters)", "optional": true },
|
||||||
|
"lastname": { "description": "Nom de l'utilisateur.", "type": "varchar(3,30,letters)", "optional": true },
|
||||||
|
"mail": { "description": "Adresse mail de l'utilisateur.", "type": "mail", "optional": true },
|
||||||
|
"password": { "description": "Mot de passe de l'utilisateur.", "type": "text", "optional": true },
|
||||||
|
"status": { "description": "Status de l'utilisateur.", "type": "status", "optional": true }
|
||||||
|
|
||||||
|
},
|
||||||
|
"output": {
|
||||||
|
"status": { "description": "Status de la modification.", "type": "boolean" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
"delete": {
|
||||||
|
"description": "Suppression d'un utilisateur.",
|
||||||
|
"permissions": [],
|
||||||
|
"parameters": {
|
||||||
|
"id_user": { "description": "UID de l'utilisateur.", "type": "id" }
|
||||||
|
},
|
||||||
|
"output": {
|
||||||
|
"status": { "description": "Status de la suppression.", "type": "boolean" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
use \manager\ModuleResponse;
|
use \manager\ModuleResponse;
|
||||||
use \manager\ManagerError;
|
use \manager\ManagerError;
|
||||||
|
|
||||||
|
|
||||||
/*******************************************/
|
/*******************************************/
|
||||||
/* DEBUGGER */
|
/* DEBUGGER */
|
||||||
/*******************************************/
|
/*******************************************/
|
||||||
|
|
|
@ -23,26 +23,13 @@
|
||||||
* @return status<Boolean> Retourne si oui ou non, tout s'est bien passe
|
* @return status<Boolean> Retourne si oui ou non, tout s'est bien passe
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static function create($code=null, $username=null, $firstname=null, $lastname=null, $mail=null, $password=null, $status=null){
|
public static function create($params){
|
||||||
|
extract($params);
|
||||||
|
|
||||||
/* [1] Normalisation + verification des donnees
|
/* [1] Normalisation + verification des donnees
|
||||||
=========================================================*/
|
=========================================================*/
|
||||||
$password_hash = sessionManager::secure_sha1($password);
|
$password_hash = sessionManager::secure_sha1($password);
|
||||||
|
|
||||||
$correct_param = Database::check('user.code', $code);
|
|
||||||
$correct_param = $correct_param && Database::check('user.username', $username);
|
|
||||||
$correct_param = $correct_param && Database::check('user.firstname', $firstname);
|
|
||||||
$correct_param = $correct_param && Database::check('user.lastname', $lastname);
|
|
||||||
$correct_param = $correct_param && Database::check('user.mail', $mail);
|
|
||||||
$correct_param = $correct_param && Database::check('user.password', $password_hash);
|
|
||||||
$correct_param = $correct_param && Database::check('user.status', $status);
|
|
||||||
|
|
||||||
// Si les parametres ne sont pas corrects, on retourne une erreur
|
|
||||||
if( !$correct_param )
|
|
||||||
return array('ModuleError' => ManagerError::ParamError);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* [2] Creation de l'utilisateur
|
/* [2] Creation de l'utilisateur
|
||||||
=========================================================*/
|
=========================================================*/
|
||||||
$create_user = new Repo('user/create', array($code, $username, $firstname, $lastname, $mail, $password_hash, $status) );
|
$create_user = new Repo('user/create', array($code, $username, $firstname, $lastname, $mail, $password_hash, $status) );
|
||||||
|
@ -81,7 +68,6 @@
|
||||||
/* [5] Gestion du retour
|
/* [5] Gestion du retour
|
||||||
=========================================================*/
|
=========================================================*/
|
||||||
return array(
|
return array(
|
||||||
'ModuleError' => ManagerError::Success,
|
|
||||||
'id_user' => $id_user,
|
'id_user' => $id_user,
|
||||||
'id_cluster' => $id_group
|
'id_cluster' => $id_group
|
||||||
);
|
);
|
||||||
|
@ -100,21 +86,14 @@
|
||||||
* Renvoie FALSE si une erreur occure
|
* Renvoie FALSE si une erreur occure
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static function link($id_cluster, $id_user){
|
public static function link($params){
|
||||||
/* [1] Normalisation + verification des donnees
|
extract($parmas);
|
||||||
=========================================================*/
|
|
||||||
$correct_param = Database::check('auto_increment_id', $id_cluster);
|
|
||||||
$correct_param = $correct_param && Database::check('auto_increment_id', $id_user);
|
|
||||||
|
|
||||||
// Si les parametres ne sont pas corrects, on retourne une erreur
|
/* [1] Creation de l'association
|
||||||
if( !$correct_param )
|
|
||||||
return array('ModuleError' => ManagerError::ParamError);
|
|
||||||
|
|
||||||
/* [2] Creation de l'association
|
|
||||||
=========================================================*/
|
=========================================================*/
|
||||||
$link_user = new Repo('cluster/link', array($id_cluster, $id_user, clusterRepo::USER_CLASS));
|
$link_user = new Repo('cluster/link', array($id_cluster, $id_user, clusterRepo::USER_CLASS));
|
||||||
|
|
||||||
return $link_user;
|
return array();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,21 +110,14 @@
|
||||||
* Renvoie FALSE si une erreur occure
|
* Renvoie FALSE si une erreur occure
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static function unlink($id_cluster, $id_user){
|
public static function unlink($params){
|
||||||
/* [1] Normalisation + verification des donnees
|
extract($params);
|
||||||
=========================================================*/
|
|
||||||
$correct_param = Database::check('auto_increment_id', $id_cluster);
|
|
||||||
$correct_param = $correct_param && Database::check('auto_increment_id', $id_user);
|
|
||||||
|
|
||||||
// Si les parametres ne sont pas corrects, on retourne une erreur
|
/* [1] Suppression de l'association
|
||||||
if( !$correct_param )
|
|
||||||
return array('ModuleError' => ManagerError::ParamError);
|
|
||||||
|
|
||||||
/* [2] Suppression de l'association
|
|
||||||
=========================================================*/
|
=========================================================*/
|
||||||
$link_user = new Repo('cluster/unlink', array($id_cluster, $id_user, clusterRepo::USER_CLASS));
|
$link_user = new Repo('cluster/unlink', array($id_cluster, $id_user, clusterRepo::USER_CLASS));
|
||||||
|
|
||||||
return $link_user;
|
return array();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,7 +132,9 @@
|
||||||
* @return users<Array> Retourne la liste des utilisateurs trouves
|
* @return users<Array> Retourne la liste des utilisateurs trouves
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static function search($keyword){
|
public static function search($params){
|
||||||
|
extract($params);
|
||||||
|
|
||||||
// On recupere les donnees
|
// On recupere les donnees
|
||||||
$user = new Repo('user/search', array($keyword));
|
$user = new Repo('user/search', array($keyword));
|
||||||
|
|
||||||
|
@ -198,7 +172,9 @@
|
||||||
* @return utilisateur<Array> Utilisateur d'UID donne
|
* @return utilisateur<Array> Utilisateur d'UID donne
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static function getById($id_user){
|
public static function getById($params){
|
||||||
|
extract($params);
|
||||||
|
|
||||||
// On recupere les donnees
|
// On recupere les donnees
|
||||||
$request = new Repo('user/getById', array($id_user));
|
$request = new Repo('user/getById', array($id_user));
|
||||||
$answer = $request->answer();
|
$answer = $request->answer();
|
||||||
|
@ -224,7 +200,9 @@
|
||||||
* @return utilisateur<Array> Utilisateur de code donne
|
* @return utilisateur<Array> Utilisateur de code donne
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static function getByCode($code){
|
public static function getByCode($params){
|
||||||
|
extract($params);
|
||||||
|
|
||||||
// On recupere les donnees
|
// On recupere les donnees
|
||||||
$request = new Repo('user/getByCode', array($code));
|
$request = new Repo('user/getByCode', array($code));
|
||||||
$answer = $request->answer();
|
$answer = $request->answer();
|
||||||
|
@ -250,7 +228,10 @@
|
||||||
* @return utilisateur<Array> Utilisateur d'username donne
|
* @return utilisateur<Array> Utilisateur d'username donne
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static function getByUsername($username){
|
public static function getByUsername($params){
|
||||||
|
extract($params);
|
||||||
|
|
||||||
|
|
||||||
// On recupere les donnees
|
// On recupere les donnees
|
||||||
$request = new Repo('user/getByUsername', array($username));
|
$request = new Repo('user/getByUsername', array($username));
|
||||||
$answer = $request->answer();
|
$answer = $request->answer();
|
||||||
|
@ -276,7 +257,10 @@
|
||||||
* @return clusters<Array> Groupes de l'utilisateur donne
|
* @return clusters<Array> Groupes de l'utilisateur donne
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static function getClusters($id_user){
|
public static function getClusters($params){
|
||||||
|
extract($params);
|
||||||
|
|
||||||
|
|
||||||
// On recupere les donnees
|
// On recupere les donnees
|
||||||
$request = new Repo('user/getClusters', array($id_user));
|
$request = new Repo('user/getClusters', array($id_user));
|
||||||
$answer = $request->answer();
|
$answer = $request->answer();
|
||||||
|
@ -309,10 +293,8 @@
|
||||||
* @return status<Boolean> Retourne si oui ou non tout s'est bien deroule
|
* @return status<Boolean> Retourne si oui ou non tout s'est bien deroule
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static function edit($id_user=null, $code=null, $username=null, $firstname=null, $lastname=null, $mail=null, $password=null, $status=null){
|
public static function edit($params){
|
||||||
// Si @id_user n'est pas au bon format, on retourne une erreur
|
extract($params);
|
||||||
if( !Database::check('auto_increment_id', $id_user) )
|
|
||||||
return array('ModuleError' => ManagerError::ModuleError);
|
|
||||||
|
|
||||||
|
|
||||||
/* [1] On verifie l'existence de l'utilisateur
|
/* [1] On verifie l'existence de l'utilisateur
|
||||||
|
@ -330,26 +312,26 @@
|
||||||
=========================================================*/
|
=========================================================*/
|
||||||
$password_hash = sessionManager::secure_sha1($password);
|
$password_hash = sessionManager::secure_sha1($password);
|
||||||
|
|
||||||
/* (1) Verification des parametres (si correct et different)*/
|
/* (1) Verification des parametres (si non nul + differents)*/
|
||||||
$correct_param = array(
|
$diff_param = array(
|
||||||
'code' => Database::check('user.code', $code ) && $user_data['code'] != $code,
|
'code' => !is_null($user_data['code']) && $user_data['code'] != $code,
|
||||||
'username' => Database::check('user.username', $username ) && $user_data['username'] != $username,
|
'username' => !is_null($user_data['username']) && $user_data['username'] != $username,
|
||||||
'firstname' => Database::check('user.firstname', $firstname ) && $user_data['firstname'] != $firstname,
|
'firstname' => !is_null($user_data['firstname']) && $user_data['firstname'] != $firstname,
|
||||||
'lastname' => Database::check('user.lastname', $lastname ) && $user_data['lastname'] != $lastname,
|
'lastname' => !is_null($user_data['lastname']) && $user_data['lastname'] != $lastname,
|
||||||
'mail' => Database::check('user.mail', $mail ) && $user_data['mail'] != $mail,
|
'mail' => !is_null($user_data['mail']) && $user_data['mail'] != $mail,
|
||||||
'password' => Database::check('user.password', $password_hash ) && $user_data['password'] != $password_hash,
|
'password' => !is_null($user_data['password']) && $user_data['password'] != $password_hash,
|
||||||
'status' => Database::check('user.status', $status ) && $user_data['status'] != $status
|
'status' => !is_null($user_data['status']) && $user_data['status'] != $status
|
||||||
);
|
);
|
||||||
|
|
||||||
/* (2) Gestion des parametres optionnels */
|
/* (2) Gestion des parametres optionnels */
|
||||||
$opt_data = array(
|
$opt_data = array(
|
||||||
'code' => ($correct_param['code']) ? $code : $user_data['code'],
|
'code' => ($diff_param['code']) ? $code : $user_data['code'],
|
||||||
'username' => ($correct_param['username']) ? $username : $user_data['username'],
|
'username' => ($diff_param['username']) ? $username : $user_data['username'],
|
||||||
'firstname' => ($correct_param['firstname']) ? $firstname : $user_data['firstname'],
|
'firstname' => ($diff_param['firstname']) ? $firstname : $user_data['firstname'],
|
||||||
'lastname' => ($correct_param['lastname']) ? $lastname : $user_data['lastname'],
|
'lastname' => ($diff_param['lastname']) ? $lastname : $user_data['lastname'],
|
||||||
'mail' => ($correct_param['mail']) ? $mail : $user_data['mail'],
|
'mail' => ($diff_param['mail']) ? $mail : $user_data['mail'],
|
||||||
'password' => ($correct_param['password']) ? $password : $user_data['password'],
|
'password' => ($diff_param['password']) ? $password : $user_data['password'],
|
||||||
'status' => ($correct_param['status']) ? $status : $user_data['status'],
|
'status' => ($diff_param['status']) ? $status : $user_data['status'],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
@ -385,7 +367,10 @@
|
||||||
* @return status<Boolean> Retourne si oui ou non tout s'est bien deroule
|
* @return status<Boolean> Retourne si oui ou non tout s'est bien deroule
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static function delete($id_user){
|
public static function delete($params){
|
||||||
|
extract($params);
|
||||||
|
|
||||||
|
|
||||||
// On recupere les donnees
|
// On recupere les donnees
|
||||||
$request = new Repo('user/delete', array($id_user));
|
$request = new Repo('user/delete', array($id_user));
|
||||||
$answer = $request->answer();
|
$answer = $request->answer();
|
||||||
|
|
|
@ -80,13 +80,13 @@
|
||||||
=========================================================*/
|
=========================================================*/
|
||||||
$entity_exists = false;
|
$entity_exists = false;
|
||||||
/* (1) Utilisateur */
|
/* (1) Utilisateur */
|
||||||
if( $class == 0 ){
|
if( $class == self::USER_CLASS ){
|
||||||
// On verifie si c'est un utilisateur
|
// On verifie si c'est un utilisateur
|
||||||
$user_check = userRepo::getById($id_entity);
|
$user_check = userRepo::getById($id_entity);
|
||||||
$entity_exists = ( $user_check !== FALSE );
|
$entity_exists = ( $user_check !== FALSE );
|
||||||
|
|
||||||
/* (2) Machine */
|
/* (2) Machine */
|
||||||
}elseif( $class == 1 ){
|
}elseif( $class == self::MACHINE_CLASS ){
|
||||||
// On verifie si c'est une machine
|
// On verifie si c'est une machine
|
||||||
$machine_check = machineRepo::getById($id_entity);
|
$machine_check = machineRepo::getById($id_entity);
|
||||||
$entity_exists = ( $machine_check !== FALSE );
|
$entity_exists = ( $machine_check !== FALSE );
|
||||||
|
@ -203,7 +203,7 @@
|
||||||
*/
|
*/
|
||||||
public static function getById($id){
|
public static function getById($id){
|
||||||
// On ecrit la requete
|
// On ecrit la requete
|
||||||
$request = Database::getPDO()->prepare("SELECT * FROM cluster
|
$request = Database::getPDO()->prepare("SELECT * FROM cluster
|
||||||
WHERE id_cluster = :id");
|
WHERE id_cluster = :id");
|
||||||
|
|
||||||
// On execute la requete
|
// On execute la requete
|
||||||
|
@ -239,7 +239,7 @@
|
||||||
*/
|
*/
|
||||||
public static function getByName($name){
|
public static function getByName($name){
|
||||||
// On ecrit la requete
|
// On ecrit la requete
|
||||||
$request = Database::getPDO()->prepare("SELECT * FROM cluster
|
$request = Database::getPDO()->prepare("SELECT * FROM cluster
|
||||||
WHERE name = :name");
|
WHERE name = :name");
|
||||||
|
|
||||||
|
|
||||||
|
@ -280,7 +280,7 @@
|
||||||
*/
|
*/
|
||||||
public static function getMerge($id_cluster, $id_entity, $class){
|
public static function getMerge($id_cluster, $id_entity, $class){
|
||||||
// On ecrit la requete
|
// On ecrit la requete
|
||||||
$request = Database::getPDO()->prepare("SELECT * FROM cluster_merge
|
$request = Database::getPDO()->prepare("SELECT * FROM cluster_merge
|
||||||
WHERE id_cluster = :id_cluster
|
WHERE id_cluster = :id_cluster
|
||||||
AND id_entity = :id_entity
|
AND id_entity = :id_entity
|
||||||
AND class = :class");
|
AND class = :class");
|
||||||
|
@ -393,7 +393,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -401,4 +401,4 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -59,8 +59,8 @@
|
||||||
/************/
|
/************/
|
||||||
public static function session_start(){
|
public static function session_start(){
|
||||||
|
|
||||||
// \session_start();
|
\session_start();
|
||||||
// return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -56,10 +56,10 @@
|
||||||
|
|
||||||
echo "<section data-sublink='view' class='list'>";
|
echo "<section data-sublink='view' class='list'>";
|
||||||
// echo 'Liste des utilisateurs: <br>';
|
// echo 'Liste des utilisateurs: <br>';
|
||||||
|
|
||||||
// si erreur, on affiche l'explicitation
|
// si erreur, on affiche l'explicitation
|
||||||
if( $answer->error != ManagerError::Success ){
|
if( $answer->error != ManagerError::Success ){
|
||||||
// var_dump( ManagerError::explicit($answer->error) );
|
var_dump( ManagerError::explicit($answer->error) );
|
||||||
|
|
||||||
echo "<span class='error'>Une erreur est survenue, veuilez contacter le webmaster si cette erreur persiste.</span>";
|
echo "<span class='error'>Une erreur est survenue, veuilez contacter le webmaster si cette erreur persiste.</span>";
|
||||||
}
|
}
|
||||||
|
@ -77,12 +77,12 @@
|
||||||
|
|
||||||
echo "<article class='inline-box' id='".$user['id_user']."'>";
|
echo "<article class='inline-box' id='".$user['id_user']."'>";
|
||||||
|
|
||||||
// Prenom Nom
|
// Prenom Nom
|
||||||
echo "<span class='title'>".$user['firstname']." ".$user['lastname']." <span>#".$user['username']."</span></span>";
|
echo "<span class='title'>".$user['firstname']." ".$user['lastname']." <span>#".$user['username']."</span></span>";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Icone vers la suppression
|
// Icone vers la suppression
|
||||||
echo "<span class='link_remove' data-user='".$user['id_user']."'>";
|
echo "<span class='link_remove' data-user='".$user['id_user']."'>";
|
||||||
echo ResourceDispatcher::getResource('f/svg/remove/st/sub-menu-side');
|
echo ResourceDispatcher::getResource('f/svg/remove/st/sub-menu-side');
|
||||||
echo "</span>";
|
echo "</span>";
|
||||||
|
@ -97,7 +97,7 @@
|
||||||
// Code RFID
|
// Code RFID
|
||||||
echo "<span class='code'>";
|
echo "<span class='code'>";
|
||||||
echo ResourceDispatcher::getResource('f/svg/card/st/container');
|
echo ResourceDispatcher::getResource('f/svg/card/st/container');
|
||||||
|
|
||||||
echo "<span>";
|
echo "<span>";
|
||||||
echo $user['code'];
|
echo $user['code'];
|
||||||
echo "</span>";
|
echo "</span>";
|
||||||
|
@ -106,7 +106,7 @@
|
||||||
// Adresse email
|
// Adresse email
|
||||||
echo "<span class='mail'>";
|
echo "<span class='mail'>";
|
||||||
echo ResourceDispatcher::getResource('f/svg/mail/st/container');
|
echo ResourceDispatcher::getResource('f/svg/mail/st/container');
|
||||||
|
|
||||||
echo "<a href='mailto:".$user['mail']."'><span>";
|
echo "<a href='mailto:".$user['mail']."'><span>";
|
||||||
echo $user['mail'];
|
echo $user['mail'];
|
||||||
echo "</span></a>";
|
echo "</span></a>";
|
||||||
|
@ -115,7 +115,7 @@
|
||||||
// Groupes de la machine
|
// Groupes de la machine
|
||||||
echo "<span class='groups'>";
|
echo "<span class='groups'>";
|
||||||
echo ResourceDispatcher::getResource('f/svg/group/st/container');
|
echo ResourceDispatcher::getResource('f/svg/group/st/container');
|
||||||
|
|
||||||
if( $clusters != false )
|
if( $clusters != false )
|
||||||
foreach($clusters as $cluster)
|
foreach($clusters as $cluster)
|
||||||
echo "<span>".$cluster['name']."</span>";
|
echo "<span>".$cluster['name']."</span>";
|
||||||
|
@ -181,9 +181,9 @@
|
||||||
echo "<span class='remove_search_view'>utilisateur <span class='remove_search_num'>0</span> sur <span class='remove_search_sum'>0</span></span><br><br>";
|
echo "<span class='remove_search_view'>utilisateur <span class='remove_search_num'>0</span> sur <span class='remove_search_sum'>0</span></span><br><br>";
|
||||||
echo "<button id='remove_search_submit' class='search'>Trouver</button><br>";
|
echo "<button id='remove_search_submit' class='search'>Trouver</button><br>";
|
||||||
|
|
||||||
|
|
||||||
echo "<br><br><hr class='OR' data-label='PUIS' /><br><br>";
|
echo "<br><br><hr class='OR' data-label='PUIS' /><br><br>";
|
||||||
|
|
||||||
// Suppression d'utilisateur
|
// Suppression d'utilisateur
|
||||||
echo "<input id='remove_code' type='text' placeholder='Code'><br>";
|
echo "<input id='remove_code' type='text' placeholder='Code'><br>";
|
||||||
echo "<input id='remove_username' type='text' placeholder='Username'><br>";
|
echo "<input id='remove_username' type='text' placeholder='Username'><br>";
|
||||||
|
@ -213,7 +213,7 @@
|
||||||
// Indice du resultat
|
// Indice du resultat
|
||||||
echo "<span class='edit_search_view'>utilisateur <span class='edit_search_num'>0</span> sur <span class='edit_search_sum'>0</span></span><br><br>";
|
echo "<span class='edit_search_view'>utilisateur <span class='edit_search_num'>0</span> sur <span class='edit_search_sum'>0</span></span><br><br>";
|
||||||
echo "<button id='edit_search_submit' class='search'>Trouver</button><br>";
|
echo "<button id='edit_search_submit' class='search'>Trouver</button><br>";
|
||||||
|
|
||||||
echo "<br><br><hr class='OR' data-label='PUIS' /><br><br>";
|
echo "<br><br><hr class='OR' data-label='PUIS' /><br><br>";
|
||||||
|
|
||||||
echo "<input id='edit_code' type='text' placeholder='CO-DE-RF-ID'><br>";
|
echo "<input id='edit_code' type='text' placeholder='CO-DE-RF-ID'><br>";
|
||||||
|
@ -244,7 +244,7 @@
|
||||||
echo "<section data-sublink='filter'>";
|
echo "<section data-sublink='filter'>";
|
||||||
|
|
||||||
echo "<form class='neutral'>";
|
echo "<form class='neutral'>";
|
||||||
|
|
||||||
echo "</form>";
|
echo "</form>";
|
||||||
|
|
||||||
echo '</section>';
|
echo '</section>';
|
||||||
|
|
Loading…
Reference in New Issue