ManagerError devient un module
This commit is contained in:
parent
95a9901403
commit
84b0928457
|
@ -3,7 +3,7 @@
|
|||
namespace api\core;
|
||||
use \database\core\Database;
|
||||
use \api\core\Authentification;
|
||||
use \manager\ManagerError;
|
||||
use \error\core\Error;
|
||||
|
||||
|
||||
class ModuleRequest{
|
||||
|
@ -41,7 +41,7 @@
|
|||
public function __construct($path=null, $params=null){
|
||||
// Si pas parametre manquant, on quitte
|
||||
if( $path == null ){
|
||||
$this->error = ManagerError::MissingPath;
|
||||
$this->error = Error::MissingPath;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@
|
|||
|
||||
// Gestion de l'erreur de parsage
|
||||
if( $this->modules == null ){
|
||||
$this->error = ManagerError::ParsingFailed;
|
||||
$this->error = Error::ParsingFailed;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@
|
|||
=========================================================*/
|
||||
// Type de @path
|
||||
if( !is_string($path) ){ // Si le type est incorrect
|
||||
$this->error = ManagerError::WrongPathModule;
|
||||
$this->error = Error::WrongPathModule;
|
||||
return false; // On retourne FALSE, si erreur
|
||||
}
|
||||
|
||||
|
@ -86,7 +86,7 @@
|
|||
/* [4] Verification des parametres (si @type est defini)
|
||||
=========================================================*/
|
||||
if( !$this->checkParams($params) ){ // Verification de tous les types
|
||||
$this->error = ManagerError::ParamError;
|
||||
$this->error = Error::ParamError;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -98,7 +98,7 @@
|
|||
/* [6] Construction de l'objet
|
||||
=========================================================*/
|
||||
$this->params = $params;
|
||||
$this->error = ManagerError::Success;
|
||||
$this->error = Error::Success;
|
||||
|
||||
return true; // On retourne que tout s'est bien passe
|
||||
|
||||
|
@ -119,14 +119,14 @@
|
|||
|
||||
/* [1] On verifie qu'aucune erreur n'a ete signalee
|
||||
=========================================================*/
|
||||
if( $this->error != ManagerError::Success ) // si il y a une erreur
|
||||
if( $this->error != Error::Success ) // si il y a une erreur
|
||||
return new ModuleResponse($this->error); // on la passe a la reponse
|
||||
|
||||
|
||||
/* [2] On verifie que la methode est amorcable
|
||||
=========================================================*/
|
||||
if( !is_callable($this->getFunctionCaller()) ){
|
||||
$this->error = ManagerError::UncallableMethod;
|
||||
$this->error = Error::UncallableMethod;
|
||||
return new ModuleResponse($this->error);
|
||||
}
|
||||
|
||||
|
@ -158,14 +158,14 @@
|
|||
public function download(){
|
||||
/* [1] On verifie qu'aucune erreur n'a ete signalee
|
||||
=========================================================*/
|
||||
if( $this->error != ManagerError::Success ) // si il y a une erreur
|
||||
if( $this->error != Error::Success ) // si il y a une erreur
|
||||
return new ModuleResponse($this->error); // on la passe a la reponse
|
||||
|
||||
|
||||
/* [2] On verifie que la methode est amorcable
|
||||
=========================================================*/
|
||||
if( !is_callable($this->getFunctionCaller()) ){
|
||||
$this->error = ManagerError::UncallableMethod;
|
||||
$this->error = Error::UncallableMethod;
|
||||
return new ModuleResponse($this->error);
|
||||
}
|
||||
|
||||
|
@ -178,14 +178,14 @@
|
|||
/* [4] Vérification des erreurs et paramètres
|
||||
=========================================================*/
|
||||
/* (1) Vérification de l'erreur retournée, si pas Success, on retourne l'erreur */
|
||||
if( isset($returned['ModuleError']) && $returned['ModuleError'] != ManagerError::Success ){
|
||||
if( isset($returned['ModuleError']) && $returned['ModuleError'] != Error::Success ){
|
||||
$this->error = $returned['ModuleError'];
|
||||
return new ModuleResponse($this->error);
|
||||
}
|
||||
|
||||
/* (2) Vérification du contenu, si pas défini */
|
||||
if( !isset($returned['body']) ){
|
||||
$this->error = ManagerError::ParamError;
|
||||
$this->error = Error::ParamError;
|
||||
return new ModuleResponse($this->error);
|
||||
}
|
||||
|
||||
|
@ -233,7 +233,7 @@
|
|||
fclose($tmpfile);
|
||||
chmod($tmpfnameroot, 0775);
|
||||
|
||||
$response = new ModuleResponse(ManagerError::Success);
|
||||
$response = new ModuleResponse(Error::Success);
|
||||
$response->append('link', $tmpfname);
|
||||
|
||||
return $response;
|
||||
|
@ -317,7 +317,7 @@
|
|||
/* [1] Verification format general
|
||||
=========================================================*/
|
||||
if( !preg_match('#^([\w_-]+)/([\w_-]+)$#i', $path, $matches) ){ // Si mauvais format
|
||||
$this->error = ManagerError::WrongPathModule;
|
||||
$this->error = Error::WrongPathModule;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -329,7 +329,7 @@
|
|||
/* [2] Verification de l'existence du module (conf)
|
||||
=========================================================*/
|
||||
if( !array_key_exists($module, $this->modules) ){ // Si le module n'est pas specifie dans la conf
|
||||
$this->error = ManagerError::UnknownModule;
|
||||
$this->error = Error::UnknownModule;
|
||||
return false; // On retourne FALSE, si erreur
|
||||
}
|
||||
|
||||
|
@ -337,7 +337,7 @@
|
|||
/* [3] Verification de l'existence de la methode (conf)
|
||||
=========================================================*/
|
||||
if( array_key_exists($method, $this->modules[$module]) === false ){ // Si la methode n'est pas specifie dans la conf
|
||||
$this->error = ManagerError::UnknownMethod;
|
||||
$this->error = Error::UnknownMethod;
|
||||
return false; // On retourne FALSE, si erreur
|
||||
}
|
||||
|
||||
|
@ -380,7 +380,7 @@
|
|||
|
||||
/* (1) On retourne FAUX si aucun droit n'a ete trouve */
|
||||
if( !$granted ){
|
||||
$this->error = ManagerError::PermissionError;
|
||||
$this->error = Error::PermissionError;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -399,7 +399,7 @@
|
|||
|
||||
/* (3) Si aucune autorisation et pas module "Default" */
|
||||
if( !$allowedModule && !$defaultModule ){
|
||||
$this->error = ManagerError::DisabledModule;
|
||||
$this->error = Error::DisabledModule;
|
||||
return false; // On retourne FALSE, si erreur
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace api\core;
|
||||
use \manager\ManagerError;
|
||||
use \error\core\Error;
|
||||
|
||||
|
||||
// FORMAT:
|
||||
|
@ -31,7 +31,7 @@
|
|||
* @error<ModuleError> Erreur passee par la requete (si existe)
|
||||
*
|
||||
*/
|
||||
public function __construct($error=ManagerError::Success){
|
||||
public function __construct($error=Error::Success){
|
||||
$this->data = [];
|
||||
$this->error = $error;
|
||||
}
|
||||
|
@ -138,7 +138,7 @@
|
|||
public function serialize(){
|
||||
|
||||
// Code Http
|
||||
ManagerError::setHttpCode($this->error);
|
||||
Error::setHttpCode($this->error);
|
||||
|
||||
// Type de contenu
|
||||
// header('Content-Type: application/json; charset=utf-8');
|
||||
|
@ -146,7 +146,7 @@
|
|||
// On rajoute l'erreur au message
|
||||
$returnData = array_merge([
|
||||
'ModuleError' => $this->error,
|
||||
'ErrorDescription' => ManagerError::explicit($this->error)
|
||||
'ErrorDescription' => Error::explicit($this->error)
|
||||
],
|
||||
$this->data
|
||||
);
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
use \database\core\Database;
|
||||
use \manager\sessionManager;
|
||||
use \api\core\Authentification;
|
||||
use \manager\ManagerError;
|
||||
use \error\core\Error;
|
||||
use \database\core\Repo;
|
||||
use \manager\repo\cluster as clusterRepo;
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
use \viewer\core\Viewer;
|
||||
use \database\core\Database;
|
||||
use \manager\sessionManager;
|
||||
use \manager\ManagerError;
|
||||
use \error\core\Error;
|
||||
use \database\core\Repo;
|
||||
use \manager\repo\cluster as clusterRepo;
|
||||
|
||||
|
@ -35,7 +35,7 @@
|
|||
|
||||
// Si une erreur est retournee, on retourne une erreur
|
||||
if( $id_cluster === false )
|
||||
return ['ModuleError' => ManagerError::ModuleError];
|
||||
return ['ModuleError' => Error::ModuleError];
|
||||
|
||||
|
||||
/* [5] Gestion du retour
|
||||
|
@ -158,7 +158,7 @@
|
|||
|
||||
// Si aucun resultat, on retourne une erreur
|
||||
if( $answer === false )
|
||||
return [ 'ModuleError' => ManagerError::NoMatchFound ];
|
||||
return [ 'ModuleError' => Error::NoMatchFound ];
|
||||
|
||||
|
||||
return [ 'cluster' => $answer ];
|
||||
|
@ -190,7 +190,7 @@
|
|||
|
||||
// Si aucun resultat, on retourne une erreur
|
||||
if( $answer === false )
|
||||
return [ 'ModuleError' => ManagerError::NoMatchFound ];
|
||||
return [ 'ModuleError' => Error::NoMatchFound ];
|
||||
|
||||
|
||||
return [ 'cluster' => $answer ];
|
||||
|
@ -222,7 +222,7 @@
|
|||
|
||||
// Si aucun resultat, on retourne une erreur
|
||||
if( $answer === false )
|
||||
return [ 'ModuleError' => ManagerError::NoMatchFound ];
|
||||
return [ 'ModuleError' => Error::NoMatchFound ];
|
||||
|
||||
|
||||
return [ 'members' => $answer ];
|
||||
|
@ -257,7 +257,7 @@
|
|||
|
||||
// Si on a recupere aucun utilisateur, on retourne une erreur
|
||||
if( $cluster_data === false )
|
||||
return ['ModuleError' => ManagerError::NoMatchFound];
|
||||
return ['ModuleError' => Error::NoMatchFound];
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace api\module;
|
||||
use \database\core\Database;
|
||||
use \manager\sessionManager;
|
||||
use \manager\ManagerError;
|
||||
use \error\core\Error;
|
||||
use \database\core\Repo;
|
||||
use \manager\repo\cluster as clusterRepo;
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
|||
|
||||
// Si une erreur est retournee, on retourne une erreur
|
||||
if( $id_machine === false )
|
||||
return ['ModuleError' => ManagerError::ModuleError];
|
||||
return ['ModuleError' => Error::ModuleError];
|
||||
|
||||
|
||||
|
||||
|
@ -157,7 +157,7 @@
|
|||
|
||||
// Si aucun resultat, on retourne une erreur
|
||||
if( $answer === false )
|
||||
return [ 'ModuleError' => ManagerError::NoMatchFound ];
|
||||
return [ 'ModuleError' => Error::NoMatchFound ];
|
||||
|
||||
|
||||
return [ 'machine' => $answer ];
|
||||
|
@ -187,7 +187,7 @@
|
|||
|
||||
// Si aucun resultat, on retourne une erreur
|
||||
if( $answer === false )
|
||||
return [ 'ModuleError' => ManagerError::NoMatchFound ];
|
||||
return [ 'ModuleError' => Error::NoMatchFound ];
|
||||
|
||||
|
||||
return [ 'machine' => $answer ];
|
||||
|
@ -216,7 +216,7 @@
|
|||
|
||||
// Si aucun resultat, on retourne une erreur
|
||||
if( $answer === false )
|
||||
return [ 'ModuleError' => ManagerError::NoMatchFound ];
|
||||
return [ 'ModuleError' => Error::NoMatchFound ];
|
||||
|
||||
|
||||
return [ 'clusters' => $answer ];
|
||||
|
@ -248,7 +248,7 @@
|
|||
|
||||
// Si on a recupere aucune machine, on retourne une erreur
|
||||
if( !is_array($machine_data) )
|
||||
return ['ModuleError' => ManagerError::NoMatchFound];
|
||||
return ['ModuleError' => Error::NoMatchFound];
|
||||
|
||||
|
||||
|
||||
|
@ -468,7 +468,7 @@
|
|||
|
||||
// Si token incorrect, on envoie une erreur
|
||||
if( $checkToken->answer() !== true )
|
||||
return [ 'ModuleError' => ManagerError::TokenError ];
|
||||
return [ 'ModuleError' => Error::TokenError ];
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace api\module;
|
||||
use \manager\ManagerError;
|
||||
use \error\core\Error;
|
||||
use \manager\ResourceDispatcher;
|
||||
|
||||
class module{
|
||||
|
@ -12,7 +12,7 @@
|
|||
public static function method($params){
|
||||
|
||||
return [
|
||||
'ModuleError' => ManagerError::Success,
|
||||
'ModuleError' => Error::Success,
|
||||
'ReceivedArguments' => $params
|
||||
];
|
||||
|
||||
|
@ -31,7 +31,7 @@
|
|||
|
||||
// Gestion de l'erreur de parsage
|
||||
if( $modules == null )
|
||||
return [ 'ModuleError' => ManagerError::ParsingFailed ];
|
||||
return [ 'ModuleError' => Error::ParsingFailed ];
|
||||
|
||||
/* [2] Mise en forme de la liste des modules
|
||||
=========================================================*/
|
||||
|
@ -61,7 +61,7 @@
|
|||
/* [n] Gestion du retour
|
||||
=========================================================*/
|
||||
return [
|
||||
'ModuleError' => ManagerError::Success,
|
||||
'ModuleError' => Error::Success,
|
||||
'headers' => [
|
||||
'Content-Type' => 'text/markdown; charset=utf-8',
|
||||
'Content-Transfer-Encoding' => 'binary',
|
||||
|
@ -87,7 +87,7 @@
|
|||
|
||||
// Gestion de l'erreur de parsage
|
||||
if( $modules == null )
|
||||
return [ 'ModuleError' => ManagerError::ParsingFailed ];
|
||||
return [ 'ModuleError' => Error::ParsingFailed ];
|
||||
|
||||
|
||||
/* [1] Début du fichier custom
|
||||
|
@ -259,7 +259,7 @@
|
|||
|
||||
|
||||
return [
|
||||
'ModuleError' => ManagerError::Success,
|
||||
'ModuleError' => Error::Success,
|
||||
'headers' => [
|
||||
'Content-Type' => 'application/octet-stream; charset=utf-8',
|
||||
'Content-Transfer-Encoding' => 'binary',
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace api\module;
|
||||
use \database\core\Database;
|
||||
use \manager\sessionManager;
|
||||
use \manager\ManagerError;
|
||||
use \error\core\Error;
|
||||
use \database\core\Repo;
|
||||
|
||||
class userDefault{
|
||||
|
@ -37,7 +37,7 @@
|
|||
|
||||
// Si une erreur est retournee, on retourne une erreur
|
||||
if( $id_user === false )
|
||||
return ['ModuleError' => ManagerError::ModuleError];
|
||||
return ['ModuleError' => Error::ModuleError];
|
||||
|
||||
|
||||
/* [2] Gestion du retour
|
||||
|
@ -165,7 +165,7 @@
|
|||
|
||||
// Si aucun resultat, on retourne une erreur
|
||||
if( $answer === false )
|
||||
return [ 'ModuleError' => ManagerError::NoMatchFound ];
|
||||
return [ 'ModuleError' => Error::NoMatchFound ];
|
||||
|
||||
|
||||
return [ 'user' => $answer ];
|
||||
|
@ -194,7 +194,7 @@
|
|||
|
||||
// Si aucun resultat, on retourne une erreur
|
||||
if( $answer === false )
|
||||
return [ 'ModuleError' => ManagerError::NoMatchFound ];
|
||||
return [ 'ModuleError' => Error::NoMatchFound ];
|
||||
|
||||
|
||||
return [ 'user' => $answer ];
|
||||
|
@ -224,7 +224,7 @@
|
|||
|
||||
// Si aucun resultat, on retourne une erreur
|
||||
if( $answer === false )
|
||||
return [ 'ModuleError' => ManagerError::NoMatchFound ];
|
||||
return [ 'ModuleError' => Error::NoMatchFound ];
|
||||
|
||||
|
||||
return [ 'user' => $answer ];
|
||||
|
@ -254,7 +254,7 @@
|
|||
|
||||
// Si aucun resultat, on retourne une erreur
|
||||
if( $answer === false )
|
||||
return [ 'ModuleError' => ManagerError::NoMatchFound ];
|
||||
return [ 'ModuleError' => Error::NoMatchFound ];
|
||||
|
||||
|
||||
return [ 'clusters' => $answer ];
|
||||
|
@ -289,7 +289,7 @@
|
|||
|
||||
// Si on a recupere aucun utilisateur, on retourne une erreur
|
||||
if( !is_array($user_data) )
|
||||
return ['ModuleError' => ManagerError::NoMatchFound];
|
||||
return ['ModuleError' => Error::NoMatchFound];
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace database\core;
|
||||
use \manager\ManagerError;
|
||||
use \error\core\Error;
|
||||
|
||||
|
||||
class Database{
|
||||
|
@ -37,18 +37,18 @@
|
|||
self::$pdo = new \PDO('mysql:host='.$this->host.';dbname='.$this->dbname, $this->username, $this->password);
|
||||
|
||||
// On signale que tout s'est bien passe
|
||||
self::$error = ManagerError::Success;
|
||||
self::$error = Error::Success;
|
||||
|
||||
}catch(Exception $e){
|
||||
// On signale qu'il y a une erreur
|
||||
self::$error = ManagerError::PDOConnection;
|
||||
self::$error = Error::PDOConnection;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* retourne une instance de la classe */
|
||||
public static function getInstance(){
|
||||
if( self::$instance == null || self::$error != ManagerError::Success ){ // Si aucune instance existante OU erreur de connection
|
||||
if( self::$instance == null || self::$error != Error::Success ){ // Si aucune instance existante OU erreur de connection
|
||||
|
||||
// chargement de la configuration du server SQL
|
||||
if( !checkdnsrr($_SERVER['SERVER_NAME'], 'NS') )
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace database\core;
|
||||
|
||||
use \manager\ManagerError;
|
||||
use \error\core\Error;
|
||||
use \api\core\Authentification;
|
||||
|
||||
|
||||
|
@ -50,7 +50,7 @@
|
|||
|
||||
// Si pas parametre manquant, on quitte
|
||||
if( $path == null ){
|
||||
$this->error = ManagerError::MissingPath;
|
||||
$this->error = Error::MissingPath;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@
|
|||
|
||||
// Gestion de l'erreur de parsage
|
||||
if( $this->repositories == null ){
|
||||
$this->error = ManagerError::ParsingFailed;
|
||||
$this->error = Error::ParsingFailed;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@
|
|||
=========================================================*/
|
||||
// Type de @path
|
||||
if( !is_string($path) ){ // Si le type est incorrect
|
||||
$this->error = ManagerError::WrongPathRepo;
|
||||
$this->error = Error::WrongPathRepo;
|
||||
return false; // On retourne FALSE, si erreur
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,7 @@
|
|||
/* [3] Construction de l'objet
|
||||
=========================================================*/
|
||||
$this->params = $params;
|
||||
$this->error = ManagerError::Success;
|
||||
$this->error = Error::Success;
|
||||
|
||||
/* [4] Enregistrement de la reponse
|
||||
=========================================================*/
|
||||
|
@ -105,7 +105,7 @@
|
|||
|
||||
|
||||
public function answer(){
|
||||
if( $this->error != ManagerError::Success )
|
||||
if( $this->error != Error::Success )
|
||||
return false;
|
||||
|
||||
return $this->answer;
|
||||
|
@ -121,14 +121,14 @@
|
|||
public function dispatch(){
|
||||
/* [1] On verifie qu'aucune erreur n'a ete signalee
|
||||
=========================================================*/
|
||||
if( $this->error != ManagerError::Success ) // si il y a une erreur
|
||||
if( $this->error != Error::Success ) // si il y a une erreur
|
||||
return false; // on la passe a la reponse
|
||||
|
||||
|
||||
/* [2] On verifie que la methode est amorcable
|
||||
=========================================================*/
|
||||
if( !is_callable($this->getFunctionCaller()) ){
|
||||
$this->error = ManagerError::UncallableMethod;
|
||||
$this->error = Error::UncallableMethod;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -151,7 +151,7 @@
|
|||
/* [1] Verification format general
|
||||
=========================================================*/
|
||||
if( !preg_match('#^([\w_-]+)/([\w_-]+)$#i', $path, $matches) ){ // Si mauvais format
|
||||
$this->error = ManagerError::WrongPathRepo;
|
||||
$this->error = Error::WrongPathRepo;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -162,14 +162,14 @@
|
|||
/* [2] Verification de l'existence du repo (conf)
|
||||
=========================================================*/
|
||||
if( !array_key_exists($repository, $this->repositories) ){ // Si le repo n'est pas specifie dans la conf
|
||||
$this->error = ManagerError::UnknownRepo;
|
||||
$this->error = Error::UnknownRepo;
|
||||
return false; // On retourne FALSE, si erreur
|
||||
}
|
||||
|
||||
/* [3] Verification de l'existence de la methode (conf)
|
||||
=========================================================*/
|
||||
if( array_search($method, $this->repositories[$repository]) === false ){ // Si la methode n'est pas specifie dans la conf
|
||||
$this->error = ManagerError::UnknownMethod;
|
||||
$this->error = Error::UnknownMethod;
|
||||
return false; // On retourne FALSE, si erreur
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace database\repo;
|
||||
use \database\core\Database;
|
||||
use \database\core\Repo;
|
||||
use \manager\ManagerError;
|
||||
use \error\core\Error;
|
||||
use \manager\repo\cluster as clusterRepo;
|
||||
|
||||
class action extends parentRepo{
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace database\repo;
|
||||
use \database\core\Database;
|
||||
use \database\core\Repo;
|
||||
use \manager\ManagerError;
|
||||
use \error\core\Error;
|
||||
use \orm\core\Table;
|
||||
use \orm\core\Rows;
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
|||
* @id_source<int> UID d'un groupe UTILISATEUR
|
||||
* @id_action<int> UID d'une ACTION
|
||||
*
|
||||
* @return error<ManagerError> Retourne l'erreur 'ManagerError' associée
|
||||
* @return error<Error> Retourne l'erreur 'Error' associée
|
||||
*
|
||||
*/
|
||||
public static function addPermission($id_target, $id_source, $id_action){
|
||||
|
@ -35,7 +35,7 @@
|
|||
|
||||
/* (2) Si aucun résultat, on retourne une erreur */
|
||||
if( $targetCheck === false )
|
||||
return ManagerError::NoMatchFound;
|
||||
return Error::NoMatchFound;
|
||||
|
||||
|
||||
/* [2] On vérifie l'existance du groupe 'source'
|
||||
|
@ -49,7 +49,7 @@
|
|||
|
||||
/* (2) Si aucun résultat, on retourne une erreur */
|
||||
if( $sourceCheck === false )
|
||||
return ManagerError::NoMatchFound;
|
||||
return Error::NoMatchFound;
|
||||
|
||||
|
||||
/* [3] On vérifie l'existance de l'action
|
||||
|
@ -60,7 +60,7 @@
|
|||
|
||||
/* (2) Si aucun résultat, on retourne une erreur */
|
||||
if( $actionCheck === false )
|
||||
return ManagerError::NoMatchFound;
|
||||
return Error::NoMatchFound;
|
||||
|
||||
|
||||
/* [4] On vérifie que l'entrée n'existe pas déja
|
||||
|
@ -74,7 +74,7 @@
|
|||
/* (3) Si les données sont identiques pour au moins une entrée, on retourne un succès */
|
||||
foreach($checkAlready as $s=>$sameTarget)
|
||||
if( $sameTarget['id_source'] == $id_source && $sameTarget['id_action'] == $id_action )
|
||||
return ManagerError::Success;
|
||||
return Error::Success;
|
||||
|
||||
}
|
||||
|
||||
|
@ -92,10 +92,10 @@
|
|||
|
||||
/* (2) Si erreur SQL, on retourne une erreur */
|
||||
if( !$inserted )
|
||||
return ManagerError::RepoError;
|
||||
return Error::RepoError;
|
||||
|
||||
|
||||
return ManagerError::Success;
|
||||
return Error::Success;
|
||||
}
|
||||
|
||||
|
||||
|
@ -112,7 +112,7 @@
|
|||
* @id_source<int> UID d'un groupe UTILISATEUR
|
||||
* @id_action<int> UID d'une PERMISSION
|
||||
*
|
||||
* @return error<ManagerError> Retourne l'erreur 'ManagerError' associée
|
||||
* @return error<Error> Retourne l'erreur 'Error' associée
|
||||
*
|
||||
*/
|
||||
public static function removePermission($id_target, $id_source, $id_action){
|
||||
|
@ -134,7 +134,7 @@
|
|||
|
||||
/* (3) Si on a pas trouvé, on retourne une erreur */
|
||||
if( is_null($existingId) )
|
||||
return ManagerError::NoMatchFound;
|
||||
return Error::NoMatchFound;
|
||||
|
||||
|
||||
/* [2] On supprime la action
|
||||
|
@ -150,10 +150,10 @@
|
|||
|
||||
/* (2) Si erreur SQL, on retourne une erreur */
|
||||
if( !$deleted || self::getById($existingId) !== false )
|
||||
return ManagerError::RepoError;
|
||||
return Error::RepoError;
|
||||
|
||||
|
||||
return ManagerError::Success;
|
||||
return Error::Success;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace database\repo;
|
||||
use \database\core\Database;
|
||||
use \database\core\Repo;
|
||||
use \manager\ManagerError;
|
||||
use \error\core\Error;
|
||||
use \orm\core\Table;
|
||||
use \orm\core\Rows;
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace database\repo;
|
||||
use \database\core\Database;
|
||||
use \database\core\Repo;
|
||||
use \manager\ManagerError;
|
||||
use \error\core\Error;
|
||||
use \manager\repo\cluster as clusterRepo;
|
||||
|
||||
class global_state extends parentRepo{
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace database\repo;
|
||||
use \database\core\Database;
|
||||
use \manager\ManagerError;
|
||||
use \error\core\Error;
|
||||
use \database\core\Repo;
|
||||
use \orm\core\Table;
|
||||
use \orm\core\Rows;
|
||||
|
@ -60,7 +60,7 @@
|
|||
* @id_machine_cluster<int> UID du groupe
|
||||
* @id_machine<int> UID de la machine
|
||||
*
|
||||
* @return error<int> Renvoie le code 'ManagerError'
|
||||
* @return error<int> Renvoie le code 'Error'
|
||||
*
|
||||
*/
|
||||
public static function link($id_warehouse, $id_machine_cluster, $id_machine){
|
||||
|
@ -76,7 +76,7 @@
|
|||
|
||||
// Si le groupe n'existe pas
|
||||
if( $cluster === false )
|
||||
return ManagerError::NoMatchFound;
|
||||
return Error::NoMatchFound;
|
||||
|
||||
/* (2) On récupère l'utilisateur */
|
||||
$machineR = Table::get('machine')
|
||||
|
@ -88,7 +88,7 @@
|
|||
|
||||
// Si l'utilisateur n'existe pas
|
||||
if( $machine === false )
|
||||
return ManagerError::NoMatchFound;
|
||||
return Error::NoMatchFound;
|
||||
|
||||
/* (3) On vérifie qu'il n'y a pas déja d'appartenance */
|
||||
$cluster_mergeR = Table::get('machine_cluster_merge')
|
||||
|
@ -100,7 +100,7 @@
|
|||
|
||||
// Si la relation existe déja, on ne fait rien
|
||||
if( $cluster_merge_exists !== false )
|
||||
return ManagerError::Success;
|
||||
return Error::Success;
|
||||
|
||||
|
||||
|
||||
|
@ -117,13 +117,13 @@
|
|||
|
||||
/* (2) Si erreur, on la retourne */
|
||||
if( !$inserted )
|
||||
return ManagerError::RepoError;
|
||||
return Error::RepoError;
|
||||
|
||||
/* (3) On vérifie quand même que l'entrée existe */
|
||||
$cluster_merge_inserted = $cluster_mergeR->fetch();
|
||||
|
||||
/* (4) Sinon, on renvoie que tout s'est bien passé */
|
||||
return is_array($cluster_merge_inserted) ? ManagerError::Success : ManagerError::RepoError;
|
||||
return is_array($cluster_merge_inserted) ? Error::Success : Error::RepoError;
|
||||
|
||||
}
|
||||
|
||||
|
@ -139,7 +139,7 @@
|
|||
* @id_machine_cluster<int> UID du groupe
|
||||
* @id_machine<int> UID de la machine
|
||||
*
|
||||
* @return error<int> Renvoie le code 'ManagerError'
|
||||
* @return error<int> Renvoie le code 'Error'
|
||||
*
|
||||
*/
|
||||
public static function unlink($id_warehouse, $id_machine_cluster, $id_machine){
|
||||
|
@ -150,7 +150,7 @@
|
|||
|
||||
/* (2) Si on ne trouve rien */
|
||||
if( $get_merge_id === false )
|
||||
return ManagerError::NoMatchFound;
|
||||
return Error::NoMatchFound;
|
||||
|
||||
|
||||
|
||||
|
@ -162,15 +162,15 @@
|
|||
|
||||
// Si erreur
|
||||
if( !$deleted )
|
||||
return ManagerError::RepoError;
|
||||
return Error::RepoError;
|
||||
|
||||
/* [2] On verifie que l'association n'existe plus
|
||||
=========================================================*/
|
||||
if( self::getMerge($id_warehouse, $id_machine_cluster, $id_machine) !== false )
|
||||
return ManagerError::RepoError;
|
||||
return Error::RepoError;
|
||||
|
||||
|
||||
return ManagerError::Success;
|
||||
return Error::Success;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace database\repo;
|
||||
use \database\core\Database;
|
||||
use \database\core\Repo;
|
||||
use \manager\ManagerError;
|
||||
use \error\core\Error;
|
||||
use \manager\repo\cluster as clusterRepo;
|
||||
|
||||
class pin_merge extends parentRepo{
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace database\repo;
|
||||
use \database\core\Database;
|
||||
use \database\core\Repo;
|
||||
use \manager\ManagerError;
|
||||
use \error\core\Error;
|
||||
use \manager\repo\cluster as clusterRepo;
|
||||
|
||||
class state extends parentRepo{
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace database\repo;
|
||||
use \database\core\Database;
|
||||
use \manager\ManagerError;
|
||||
use \error\core\Error;
|
||||
use \database\core\Repo;
|
||||
use \orm\core\Table;
|
||||
use \orm\core\Rows;
|
||||
|
@ -60,7 +60,7 @@
|
|||
* @id_user_cluster<int> UID du groupe
|
||||
* @id_user<int> UID de l'utilisateur
|
||||
*
|
||||
* @return error<int> Renvoie le code 'ManagerError'
|
||||
* @return error<int> Renvoie le code 'Error'
|
||||
*
|
||||
*/
|
||||
public static function link($id_warehouse, $id_user_cluster, $id_user){
|
||||
|
@ -76,7 +76,7 @@
|
|||
|
||||
// Si le groupe n'existe pas
|
||||
if( $cluster === false )
|
||||
return ManagerError::NoMatchFound;
|
||||
return Error::NoMatchFound;
|
||||
|
||||
/* (2) On récupère l'utilisateur */
|
||||
$userR = Table::get('user')
|
||||
|
@ -88,7 +88,7 @@
|
|||
|
||||
// Si l'utilisateur n'existe pas
|
||||
if( $user === false )
|
||||
return ManagerError::NoMatchFound;
|
||||
return Error::NoMatchFound;
|
||||
|
||||
/* (3) On vérifie qu'il n'y a pas déja d'appartenance */
|
||||
$cluster_mergeR = Table::get('user_cluster_merge')
|
||||
|
@ -100,7 +100,7 @@
|
|||
|
||||
// Si la relation existe déja, on ne fait rien
|
||||
if( $cluster_merge_exists !== false )
|
||||
return ManagerError::Success;
|
||||
return Error::Success;
|
||||
|
||||
|
||||
|
||||
|
@ -117,13 +117,13 @@
|
|||
|
||||
/* (2) Si erreur, on la retourne */
|
||||
if( !$inserted )
|
||||
return ManagerError::RepoError;
|
||||
return Error::RepoError;
|
||||
|
||||
/* (3) On vérifie quand même que l'entrée existe */
|
||||
$cluster_merge_inserted = $cluster_mergeR->fetch();
|
||||
|
||||
/* (4) Sinon, on renvoie que tout s'est bien passé */
|
||||
return is_array($cluster_merge_inserted) ? ManagerError::Success : ManagerError::RepoError;
|
||||
return is_array($cluster_merge_inserted) ? Error::Success : Error::RepoError;
|
||||
}
|
||||
|
||||
|
||||
|
@ -138,7 +138,7 @@
|
|||
* @id_user_cluster<int> UID du groupe
|
||||
* @id_user<int> UID de l'utilisateur
|
||||
*
|
||||
* @return error<int> Renvoie le code 'ManagerError'
|
||||
* @return error<int> Renvoie le code 'Error'
|
||||
*
|
||||
*/
|
||||
public static function unlink($id_warehouse, $id_user_cluster, $id_user){
|
||||
|
@ -149,7 +149,7 @@
|
|||
|
||||
/* (2) Si on ne trouve rien */
|
||||
if( $get_merge_id == false )
|
||||
return ManagerError::NoMatchFound;
|
||||
return Error::NoMatchFound;
|
||||
|
||||
|
||||
|
||||
|
@ -161,15 +161,15 @@
|
|||
|
||||
// Si erreur
|
||||
if( !$deleted )
|
||||
return ManagerError::RepoError;
|
||||
return Error::RepoError;
|
||||
|
||||
/* [2] On verifie que l'association n'existe plus
|
||||
=========================================================*/
|
||||
if( self::getMerge($id_warehouse, $id_user_cluster, $id_user) !== false )
|
||||
return ManagerError::ModuleError;
|
||||
return Error::ModuleError;
|
||||
|
||||
|
||||
return ManagerError::Success;
|
||||
return Error::Success;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace manager;
|
||||
namespace error\core;
|
||||
|
||||
|
||||
class ManagerError{
|
||||
class Error{
|
||||
|
||||
/* SUCCESS */
|
||||
const Success = 0;
|
|
@ -4,7 +4,7 @@
|
|||
namespace orm\core;
|
||||
|
||||
use \database\core\Database;
|
||||
use \manager\ManagerError;
|
||||
use \error\core\Error;
|
||||
use \orm\core\Rows;
|
||||
|
||||
|
||||
|
|
|
@ -3,14 +3,14 @@
|
|||
namespace viewer\core;
|
||||
|
||||
use \viewer\core\Viewer;
|
||||
use \manager\ManagerError;
|
||||
use \error\core\Error;
|
||||
|
||||
|
||||
|
||||
|
||||
class Viewer{
|
||||
|
||||
public $error = ManagerError::Success;
|
||||
public $error = Error::Success;
|
||||
|
||||
|
||||
private $template;
|
||||
|
@ -31,7 +31,7 @@
|
|||
public function __construct($template, $content){
|
||||
// Si pas parametre manquant, on quitte
|
||||
if( $template == null ){
|
||||
$this->error = ManagerError::MissingPath;
|
||||
$this->error = Error::MissingPath;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -98,7 +98,7 @@
|
|||
/* [1] On vérifie le format
|
||||
=========================================================*/
|
||||
if( !preg_match('/^([a-z]+)\.([a-z]+)$/i', $template, $match) ){
|
||||
$this->error = ManagerError::ParamError;
|
||||
$this->error = Error::ParamError;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -110,13 +110,13 @@
|
|||
|
||||
/* (1) On vérifie que la classe existe */
|
||||
if( !class_exists($class) ){
|
||||
$this->error = ManagerError::UnknownTemplate;
|
||||
$this->error = Error::UnknownTemplate;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* (2) On vérifie que la méthode existe */
|
||||
if( !method_exists($class, $method) ){
|
||||
$this->error = ManagerError::UnknownTemplate;
|
||||
$this->error = Error::UnknownTemplate;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace viewer\view\group;
|
||||
use \viewer\core\Viewer;
|
||||
use \api\core\ModuleRequest;
|
||||
use \manager\ManagerError;
|
||||
use \error\core\Error;
|
||||
use \api\core\Authentification;
|
||||
use \manager\repo\cluster as clusterRepo;
|
||||
|
||||
|
@ -48,7 +48,7 @@
|
|||
$getUserClusters = $getUserClustersReq->dispatch();
|
||||
|
||||
/* (2) Si on ne le trouve pas, on retourne une erreur */
|
||||
if( $getUserClusters->error != ManagerError::Success )
|
||||
if( $getUserClusters->error != Error::Success )
|
||||
return Viewer::$htmlError;
|
||||
|
||||
/* (3) On récupère les données du groupe */
|
||||
|
@ -78,7 +78,7 @@
|
|||
$getMachineClusters = $getMachineClustersReq->dispatch();
|
||||
|
||||
/* (2) Si on ne le trouve pas, on retourne une erreur */
|
||||
if( $getMachineClusters->error != ManagerError::Success )
|
||||
if( $getMachineClusters->error != Error::Success )
|
||||
return Viewer::$htmlError;
|
||||
|
||||
/* (3) On récupère les données du groupe */
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace viewer\view\group;
|
||||
use \viewer\core\Viewer;
|
||||
use \api\core\ModuleRequest;
|
||||
use \manager\ManagerError;
|
||||
use \error\core\Error;
|
||||
use \api\core\Authentification;
|
||||
use \manager\repo\cluster as clusterRepo;
|
||||
|
||||
|
@ -98,7 +98,7 @@
|
|||
$checktypeResponse = $checktypeRequest->dispatch();
|
||||
|
||||
/* (2) Si on ne le trouve pas, on retourne une erreur */
|
||||
if( $checktypeResponse->error != ManagerError::Success )
|
||||
if( $checktypeResponse->error != Error::Success )
|
||||
return Viewer::$htmlError;
|
||||
|
||||
/* (3) On récupère les données du groupe */
|
||||
|
@ -116,7 +116,7 @@
|
|||
$getmembersResponse = $getmembersRequest->dispatch();
|
||||
|
||||
/* (2) Si erreur, on retourne l'erreur */
|
||||
if( $getmembersResponse->error != ManagerError::Success )
|
||||
if( $getmembersResponse->error != Error::Success )
|
||||
return Viewer::$htmlError;
|
||||
|
||||
/* (3) On récupère la liste des UID uniquement */
|
||||
|
@ -137,7 +137,7 @@
|
|||
$getusersResponse = $getusersRequest->dispatch(); // On recupere la reponse
|
||||
|
||||
/* (2) si erreur, on affiche l'explicitation */
|
||||
if( $getusersResponse->error != ManagerError::Success )
|
||||
if( $getusersResponse->error != Error::Success )
|
||||
return Viewer::$htmlError;
|
||||
|
||||
/* (3) On récupère la liste des utilisateurs */
|
||||
|
@ -170,7 +170,7 @@
|
|||
$getmachinesResponse = $getmachinesRequest->dispatch(); // On recupere la reponse
|
||||
|
||||
/* (2) si erreur, on affiche l'explicitation */
|
||||
if( $getmachinesResponse->error != ManagerError::Success )
|
||||
if( $getmachinesResponse->error != Error::Success )
|
||||
return Viewer::$htmlError;
|
||||
|
||||
/* (3) On récupère la liste des machines */
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
use \viewer\core\Viewer;
|
||||
use \api\core\ModuleRequest;
|
||||
use \api\core\Authentification;
|
||||
use \manager\ManagerError;
|
||||
use \error\core\Error;
|
||||
|
||||
class group_view{
|
||||
|
||||
|
@ -91,7 +91,7 @@
|
|||
$getAllUsers = $getAllUsersReq->dispatch();
|
||||
|
||||
/* (2) si erreur, on affiche l'explicitation */
|
||||
if( $getAllUsers->error != ManagerError::Success )
|
||||
if( $getAllUsers->error != Error::Success )
|
||||
return Viewer::$htmlError;
|
||||
|
||||
/* (3) On enregistre le résultat */
|
||||
|
@ -106,7 +106,7 @@
|
|||
$getAllMachines = $getAllMachinesReq->dispatch();
|
||||
|
||||
/* (2) si erreur, on affiche l'explicitation */
|
||||
if( $getAllMachines->error != ManagerError::Success )
|
||||
if( $getAllMachines->error != Error::Success )
|
||||
return Viewer::$htmlError;
|
||||
|
||||
/* (3) On enregistre le résultat */
|
||||
|
@ -124,7 +124,7 @@
|
|||
$membersRes = $membersReq->dispatch();
|
||||
|
||||
/* (2) Gestion si erreur */
|
||||
if( $membersRes->error == ManagerError::Success ) $members = $membersRes->get('members');
|
||||
if( $membersRes->error == Error::Success ) $members = $membersRes->get('members');
|
||||
else $members = [];
|
||||
|
||||
/* (3) On crées les vues des membres (utilisateurs) */
|
||||
|
@ -165,7 +165,7 @@
|
|||
$membersRes = $membersReq->dispatch();
|
||||
|
||||
/* (2) Gestion si erreur */
|
||||
if( $membersRes->error == ManagerError::Success ) $members = $membersRes->get('members');
|
||||
if( $membersRes->error == Error::Success ) $members = $membersRes->get('members');
|
||||
else $members = [];
|
||||
|
||||
/* (3) On crées les vues des membres (machines) */
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
use \viewer\core\Viewer;
|
||||
use \api\core\ModuleRequest;
|
||||
use \api\core\Authentification;
|
||||
use \manager\ManagerError;
|
||||
use \error\core\Error;
|
||||
|
||||
class machine_groups{
|
||||
|
||||
|
@ -61,7 +61,7 @@
|
|||
$answer = $request->dispatch();
|
||||
|
||||
// si erreur, on affiche l'explicitation
|
||||
if( $answer->error != ManagerError::Success )
|
||||
if( $answer->error != Error::Success )
|
||||
return Viewer::$htmlError;
|
||||
|
||||
$CLUSTERLIST = $answer->get('clusters');
|
||||
|
@ -75,7 +75,7 @@
|
|||
$machinesRes = $machinesReq->dispatch();
|
||||
|
||||
/* (2) Gestion si erreur */
|
||||
if( $machinesRes->error == ManagerError::Success ) $machines = $machinesRes->get('members');
|
||||
if( $machinesRes->error == Error::Success ) $machines = $machinesRes->get('members');
|
||||
else $machines = [];
|
||||
|
||||
$CLUSTERLIST[$c]['count'] = count($machines);
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
use \viewer\core\Viewer;
|
||||
use \api\core\ModuleRequest;
|
||||
use \api\core\Authentification;
|
||||
use \manager\ManagerError;
|
||||
use \error\core\Error;
|
||||
|
||||
class machine_view{
|
||||
|
||||
|
@ -54,7 +54,7 @@
|
|||
$answer = $request->dispatch(); // On recupere la reponse
|
||||
|
||||
// si erreur, on affiche l'explicitation
|
||||
if( $answer->error != ManagerError::Success )
|
||||
if( $answer->error != Error::Success )
|
||||
return Viewer::$htmlError;
|
||||
|
||||
$MACHINELIST = $answer->get('machines');
|
||||
|
@ -65,7 +65,7 @@
|
|||
$clustersRes = $clustersReq->dispatch();
|
||||
|
||||
/* (2) Gestion si erreur */
|
||||
if( $clustersRes->error == ManagerError::Success ) $clusters = $clustersRes->get('clusters');
|
||||
if( $clustersRes->error == Error::Success ) $clusters = $clustersRes->get('clusters');
|
||||
else $clusters = [];
|
||||
|
||||
$MACHINELIST[$u]['grouplist'] = Viewer::replaceMultiple(
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
use \viewer\core\Viewer;
|
||||
use \api\core\ModuleRequest;
|
||||
use \api\core\Authentification;
|
||||
use \manager\ManagerError;
|
||||
use \error\core\Error;
|
||||
|
||||
class user_groups{
|
||||
|
||||
|
@ -61,7 +61,7 @@
|
|||
$answer = $request->dispatch();
|
||||
|
||||
// si erreur, on affiche l'explicitation
|
||||
if( $answer->error != ManagerError::Success )
|
||||
if( $answer->error != Error::Success )
|
||||
return Viewer::$htmlError;
|
||||
|
||||
$CLUSTERLIST = $answer->get('clusters');
|
||||
|
@ -75,7 +75,7 @@
|
|||
$usersRes = $usersReq->dispatch();
|
||||
|
||||
/* (2) Gestion si erreur */
|
||||
if( $usersRes->error == ManagerError::Success ) $users = $usersRes->get('members');
|
||||
if( $usersRes->error == Error::Success ) $users = $usersRes->get('members');
|
||||
else $users = [];
|
||||
|
||||
$CLUSTERLIST[$c]['count'] = count($users);
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
use \viewer\core\Viewer;
|
||||
use \api\core\ModuleRequest;
|
||||
use \api\core\Authentification;
|
||||
use \manager\ManagerError;
|
||||
use \error\core\Error;
|
||||
|
||||
class user_view{
|
||||
|
||||
|
@ -67,7 +67,7 @@
|
|||
$answer = $request->dispatch(); // On recupere la reponse
|
||||
|
||||
// si erreur, on affiche l'explicitation
|
||||
if( $answer->error != ManagerError::Success )
|
||||
if( $answer->error != Error::Success )
|
||||
return Viewer::$htmlError;
|
||||
|
||||
$USERLIST = $answer->get('users');
|
||||
|
@ -77,7 +77,7 @@
|
|||
$clustersRes = $clustersReq->dispatch();
|
||||
|
||||
/* (2) Gestion si erreur */
|
||||
if( $clustersRes->error == ManagerError::Success ) $clusters = $clustersRes->get('clusters');
|
||||
if( $clustersRes->error == Error::Success ) $clusters = $clustersRes->get('clusters');
|
||||
else $clusters = [];
|
||||
|
||||
$USERLIST[$u]['grouplist'] = Viewer::replaceMultiple(
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<directory prefix="Database_" suffix=".php">./tests/</directory>
|
||||
</testsuite>
|
||||
|
||||
<testsuite name="manager/ManagerError">
|
||||
<file>./tests/ManagerError.php</file>
|
||||
<testsuite name="manager/Error">
|
||||
<file>./tests/Error.php</file>
|
||||
</testsuite>
|
||||
|
||||
<testsuite name="manager/sessionManager">
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
public function testGetInstanceWithSERVERLocal(){
|
||||
// Pour regenerer une instance, on definit une erreur
|
||||
\database\core\Database::$error = \manager\ManagerError::PDOConnection;
|
||||
\database\core\Database::$error = \error\core\Error::PDOConnection;
|
||||
|
||||
|
||||
$instance = \database\core\Database::getInstance();
|
||||
|
@ -25,7 +25,7 @@
|
|||
/* [2] Verification du singleton (getInstance)
|
||||
=========================================================*/
|
||||
public function testInstancePersistence(){
|
||||
\database\core\Database::$error = \manager\ManagerError::PDOConnection;
|
||||
\database\core\Database::$error = \error\core\Error::PDOConnection;
|
||||
|
||||
$instance_construct = \database\core\Database::getInstance();
|
||||
$instance_nextuse = \database\core\Database::getInstance();
|
||||
|
@ -34,10 +34,10 @@
|
|||
}
|
||||
|
||||
public function testInstancePersistenceRefutation(){
|
||||
\database\core\Database::$error = \manager\ManagerError::PDOConnection;
|
||||
\database\core\Database::$error = \error\core\Error::PDOConnection;
|
||||
$instance_construct = \database\core\Database::getInstance();
|
||||
|
||||
\database\core\Database::$error = \manager\ManagerError::PDOConnection;
|
||||
\database\core\Database::$error = \error\core\Error::PDOConnection;
|
||||
$instance_nextuse = \database\core\Database::getInstance();
|
||||
|
||||
$this->assertNotSame( $instance_construct, $instance_nextuse );
|
||||
|
|
|
@ -1,104 +1,104 @@
|
|||
<?php namespace phpunit;
|
||||
|
||||
class ManagerError extends \PHPUnit_Framework_TestCase{
|
||||
class Error extends \PHPUnit_Framework_TestCase{
|
||||
|
||||
/* [1] Test de toutes les erreurs
|
||||
=========================================================*/
|
||||
public function testErrorSuccess(){
|
||||
$error = \manager\ManagerError::Success;
|
||||
$error = \error\core\Error::Success;
|
||||
|
||||
$this->assertNotNull( \manager\ManagerError::explicit($error) );
|
||||
$this->assertNotNull( \error\core\Error::explicit($error) );
|
||||
}
|
||||
|
||||
public function testErrorParsingFailed(){
|
||||
$error = \manager\ManagerError::ParsingFailed;
|
||||
$error = \error\core\Error::ParsingFailed;
|
||||
|
||||
$this->assertNotNull( \manager\ManagerError::explicit($error) );
|
||||
$this->assertNotNull( \error\core\Error::explicit($error) );
|
||||
}
|
||||
|
||||
public function testErrorInvalidFlags(){
|
||||
$error = \manager\ManagerError::InvalidFlags;
|
||||
$error = \error\core\Error::InvalidFlags;
|
||||
|
||||
$this->assertNotNull( \manager\ManagerError::explicit($error) );
|
||||
$this->assertNotNull( \error\core\Error::explicit($error) );
|
||||
}
|
||||
|
||||
public function testErrorUnreachableResource(){
|
||||
$error = \manager\ManagerError::UnreachableResource;
|
||||
$error = \error\core\Error::UnreachableResource;
|
||||
|
||||
$this->assertNotNull( \manager\ManagerError::explicit($error) );
|
||||
$this->assertNotNull( \error\core\Error::explicit($error) );
|
||||
}
|
||||
|
||||
public function testErrorMissingPath(){
|
||||
$error = \manager\ManagerError::MissingPath;
|
||||
$error = \error\core\Error::MissingPath;
|
||||
|
||||
$this->assertNotNull( \manager\ManagerError::explicit($error) );
|
||||
$this->assertNotNull( \error\core\Error::explicit($error) );
|
||||
}
|
||||
|
||||
public function testErrorWrongPathModule(){
|
||||
$error = \manager\ManagerError::WrongPathModule;
|
||||
$error = \error\core\Error::WrongPathModule;
|
||||
|
||||
$this->assertNotNull( \manager\ManagerError::explicit($error) );
|
||||
$this->assertNotNull( \error\core\Error::explicit($error) );
|
||||
}
|
||||
|
||||
public function testErrorUnknownModule(){
|
||||
$error = \manager\ManagerError::UnknownModule;
|
||||
$error = \error\core\Error::UnknownModule;
|
||||
|
||||
$this->assertNotNull( \manager\ManagerError::explicit($error) );
|
||||
$this->assertNotNull( \error\core\Error::explicit($error) );
|
||||
}
|
||||
|
||||
public function testErrorUnknownMethod(){
|
||||
$error = \manager\ManagerError::UnknownMethod;
|
||||
$error = \error\core\Error::UnknownMethod;
|
||||
|
||||
$this->assertNotNull( \manager\ManagerError::explicit($error) );
|
||||
$this->assertNotNull( \error\core\Error::explicit($error) );
|
||||
}
|
||||
|
||||
public function testErrorUncallableMethod(){
|
||||
$error = \manager\ManagerError::UncallableMethod;
|
||||
$error = \error\core\Error::UncallableMethod;
|
||||
|
||||
$this->assertNotNull( \manager\ManagerError::explicit($error) );
|
||||
$this->assertNotNull( \error\core\Error::explicit($error) );
|
||||
}
|
||||
|
||||
public function testErrorParamError(){
|
||||
$error = \manager\ManagerError::ParamError;
|
||||
$error = \error\core\Error::ParamError;
|
||||
|
||||
$this->assertNotNull( \manager\ManagerError::explicit($error) );
|
||||
$this->assertNotNull( \error\core\Error::explicit($error) );
|
||||
}
|
||||
|
||||
public function testErrorModuleError(){
|
||||
$error = \manager\ManagerError::ModuleError;
|
||||
$error = \error\core\Error::ModuleError;
|
||||
|
||||
$this->assertNotNull( \manager\ManagerError::explicit($error) );
|
||||
$this->assertNotNull( \error\core\Error::explicit($error) );
|
||||
}
|
||||
|
||||
public function testErrorWrongPathRepo(){
|
||||
$error = \manager\ManagerError::WrongPathRepo;
|
||||
$error = \error\core\Error::WrongPathRepo;
|
||||
|
||||
$this->assertNotNull( \manager\ManagerError::explicit($error) );
|
||||
$this->assertNotNull( \error\core\Error::explicit($error) );
|
||||
}
|
||||
|
||||
public function testErrorUnknownRepo(){
|
||||
$error = \manager\ManagerError::UnknownRepo;
|
||||
$error = \error\core\Error::UnknownRepo;
|
||||
|
||||
$this->assertNotNull( \manager\ManagerError::explicit($error) );
|
||||
$this->assertNotNull( \error\core\Error::explicit($error) );
|
||||
}
|
||||
|
||||
public function testErrorRepoError(){
|
||||
$error = \manager\ManagerError::RepoError;
|
||||
$error = \error\core\Error::RepoError;
|
||||
|
||||
$this->assertNotNull( \manager\ManagerError::explicit($error) );
|
||||
$this->assertNotNull( \error\core\Error::explicit($error) );
|
||||
}
|
||||
|
||||
public function testErrorPDOConnection(){
|
||||
$error = \manager\ManagerError::PDOConnection;
|
||||
$error = \error\core\Error::PDOConnection;
|
||||
|
||||
$this->assertNotNull( \manager\ManagerError::explicit($error) );
|
||||
$this->assertNotNull( \error\core\Error::explicit($error) );
|
||||
}
|
||||
|
||||
|
||||
public function testErrorNotKnown(){
|
||||
$error = 1239;
|
||||
|
||||
$this->assertNull( \manager\ManagerError::explicit($error) );
|
||||
$this->assertNull( \error\core\Error::explicit($error) );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
use \api\core\ModuleRequest;
|
||||
use \api\core\ModuleResponse;
|
||||
use \manager\ManagerError;
|
||||
use \error\core\Error;
|
||||
use \api\core\Authentification;
|
||||
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
use \api\core\ModuleRequest;
|
||||
use \manager\sessionManager;
|
||||
use \manager\ResourceDispatcher;
|
||||
use \manager\ManagerError;
|
||||
use \error\core\Error;
|
||||
use \database\core\Repo;
|
||||
use \database\core\Database;
|
||||
|
||||
|
@ -46,7 +46,7 @@
|
|||
$answer = $request->dispatch();
|
||||
|
||||
// Debug error
|
||||
if( $answer->error != ManagerError::Success )
|
||||
if( $answer->error != Error::Success )
|
||||
var_dump( $answer->error );
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,7 @@
|
|||
$answer = $request->dispatch();
|
||||
|
||||
// Debug error
|
||||
if( $answer->error != ManagerError::Success )
|
||||
if( $answer->error != Error::Success )
|
||||
var_dump( $answer->error );
|
||||
}
|
||||
|
||||
|
@ -106,7 +106,7 @@
|
|||
$requete = new ModuleRequest('userDefault/getAll');
|
||||
$answer = $requete->dispatch();
|
||||
|
||||
var_dump( ManagerError::explicit($answer->error) );
|
||||
var_dump( Error::explicit($answer->error) );
|
||||
var_dump( $answer->get('users') );
|
||||
|
||||
return true;
|
||||
|
@ -130,7 +130,7 @@
|
|||
$requete = new ModuleRequest('machineDefault/getAll');
|
||||
$answer = $requete->dispatch();
|
||||
|
||||
var_dump( ManagerError::explicit($answer->error) );
|
||||
var_dump( Error::explicit($answer->error) );
|
||||
var_dump( $answer->get('machines') );
|
||||
|
||||
return true;
|
||||
|
@ -157,8 +157,8 @@
|
|||
$answer = $request->dispatch();
|
||||
|
||||
// Debug error
|
||||
if( $answer->error != ManagerError::Success )
|
||||
var_dump( ManagerError::explicit($answer->error) );
|
||||
if( $answer->error != Error::Success )
|
||||
var_dump( Error::explicit($answer->error) );
|
||||
|
||||
// display result
|
||||
var_dump( $answer->getAll() );
|
||||
|
@ -209,8 +209,8 @@
|
|||
// $req1 = new Repo('user/getByCode', array('92-55-B9-B3'));
|
||||
var_dump( $req1->answer() );
|
||||
|
||||
if( $req1->error != ManagerError::Success )
|
||||
var_dump( ManagerError::explicit($req1->error) );
|
||||
if( $req1->error != Error::Success )
|
||||
var_dump( Error::explicit($req1->error) );
|
||||
|
||||
|
||||
return true;
|
||||
|
@ -234,8 +234,8 @@
|
|||
$request = new ModuleRequest('userDefault/create', ['92-55-B9-B1', 'b', 'bla', 'bla', 'bla@test.com', 'sadas', '1'] );
|
||||
$answer = $request->dispatch();
|
||||
// Debug error
|
||||
if( $answer->error != ManagerError::Success )
|
||||
var_dump( ManagerError::explicit($answer->error) );
|
||||
if( $answer->error != Error::Success )
|
||||
var_dump( Error::explicit($answer->error) );
|
||||
|
||||
var_dump( $answer->getAll() );
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php namespace test\client;
|
||||
|
||||
use \manager\ManagerError;
|
||||
use \error\core\Error;
|
||||
|
||||
/* CLASSE PERMETANT L'UTILISATION DU manifest.json POUR UTILISER DES APIS DIVERSES
|
||||
*
|
||||
|
@ -48,7 +48,7 @@
|
|||
|
||||
// Si erreur de parsage ou de fichier, on retourne une erreur
|
||||
if( $manifest === null ){
|
||||
$this->error = ManagerError::ParsingFailed;
|
||||
$this->error = Error::ParsingFailed;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php define('__ROOT__', dirname(dirname(dirname(__FILE__))) );
|
||||
require_once __ROOT__.'/autoloader.php';
|
||||
use \api\core\ModuleRequest;
|
||||
use \manager\ManagerError;
|
||||
use \error\core\Error;
|
||||
use \orm\core\Table;
|
||||
?>
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
require_once __ROOT__.'/autoloader.php';
|
||||
use \viewer\core\Viewer;
|
||||
use \api\core\ModuleRequest;
|
||||
use \manager\ManagerError;
|
||||
use \error\core\Error;
|
||||
use \database\core\Repo;
|
||||
?>
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php define('__ROOT__', dirname(dirname(dirname(__FILE__))) );
|
||||
require_once __ROOT__.'/autoloader.php';
|
||||
use \api\core\ModuleRequest;
|
||||
use \manager\ManagerError;
|
||||
use \error\core\Error;
|
||||
use \database\core\Database;
|
||||
use \database\core\Repo;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
require_once __ROOT__.'/autoloader.php';
|
||||
use \viewer\core\Viewer;
|
||||
use \api\core\ModuleRequest;
|
||||
use \manager\ManagerError;
|
||||
use \error\core\Error;
|
||||
use \database\core\Repo;
|
||||
?>
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php define('__ROOT__', dirname(dirname(dirname(__FILE__))) );
|
||||
require_once __ROOT__.'/autoloader.php';
|
||||
use \api\core\ModuleRequest;
|
||||
use \manager\ManagerError;
|
||||
use \error\core\Error;
|
||||
?>
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php define('__ROOT__', dirname(dirname(dirname(__FILE__))) );
|
||||
require_once __ROOT__.'/autoloader.php';
|
||||
use \api\core\ModuleRequest;
|
||||
use \manager\ManagerError;
|
||||
use \error\core\Error;
|
||||
?>
|
||||
|
||||
<!-- [1] Gestion du sous-menu de gauche -->
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php define('__ROOT__', dirname(dirname(dirname(__FILE__))) );
|
||||
require_once __ROOT__.'/autoloader.php';
|
||||
use \api\core\ModuleRequest;
|
||||
use \manager\ManagerError;
|
||||
use \error\core\Error;
|
||||
use \viewer\core\Viewer;
|
||||
use \database\core\Repo;
|
||||
?>
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<?php namespace view; ?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Gestion du parc</title>
|
||||
|
|
2
todo.md
2
todo.md
|
@ -149,7 +149,7 @@
|
|||
- [x] [phpunit/] Install+Config phpunit
|
||||
- [x] [Database] Checker de type (types utilises dans la BDD)
|
||||
- [x] [manager/Repo] Gestion des Repo
|
||||
- [x] [ManagerError] Correction/ajout des codes erreurs
|
||||
- [x] [Error] Correction/ajout des codes erreurs
|
||||
- [x] [ModuleRequest] Modification des erreurs
|
||||
- [x] [ResourceDispatcher] Modification du gestionnaire de ressource car ne marche pas en ligne
|
||||
- [x] [css/container.css + js/action-script.js] Gestion de l'affichage de la page associee au sous-menu (.active)
|
||||
|
|
Loading…
Reference in New Issue