UID du token en question * */ public static function remove($params){ extract($params); /* [1] Suppression du token =========================================================*/ $remove = new Repo('token/remove', [$token_id]); // On renvoie une erreur si une erreur intervient pendant la suppression if( $remove->answer() === false ) return ['ModuleError' => ManagerError::ModuleError]; /* [n] Gestion du retour quand tout est normal =========================================================*/ return [ 'ModuleError' => ManagerError::Success ]; } /* GENERE UN NOUVEAU TOKEN DE NOM ET EXPIRATION SPECIFIEE * * @name Nom attribue au token * @duration Duree du token en jours * * @return id_token Renvoie l'id du token cree * @return FALSE Renvoie FALSE si erreur * */ public static function generate($params){ extract($params); /* [0] Verification des INPUT =========================================================*/ if( !Checker::run('varchar(3,50)', $name) || !Checker::run('id', $duration) ) return ['ModuleError' => ManagerError::ParamError]; // erreur de parametre /* [1] On cree le token et recupere son id ou FAUX =========================================================*/ $create = new Repo('token/generate', [$name, $duration]); $created = $create->answer(); // Si erreur de creation if( $created === false ) return ['ModuleError' => ManagerError::ModuleError ]; /* [2] Gestion du retour =========================================================*/ return [ 'ModuleError' => ManagerError::Success, 'id_token' => $created ]; } } ?>