public static function getError($result, $error)
 {
     if ($error) {
         return $result ? $error . '; ' . APIConnector::verifNoError($result) : $error;
     }
     return null;
 }
 /**
  * athenticate this login and password
  * @return boolean
  */
 public function authFromCredentials()
 {
     if ($this->login == null || $this->password == null) {
         return false;
     }
     $post_content = array('method' => array('name' => 'authenticateFromCredentials', 'version' => 1), 'parameters' => array('login' => $this->login, 'password' => $this->password), 'debug' => array('forceSync' => true));
     // create a POST request for the connection
     $this->rest_client->clear_cache = true;
     list($result, $error) = $this->rest_client->post('/api/auth', $post_content);
     $this->rest_client->clear_cache = false;
     if ($error) {
         return false;
     }
     // check connection et get user infos
     if ($result && APIConnector::verifNoError($result) == '') {
         $this->getIdentityInfo($result);
         return $result['state'] == 'success' || $result['response']['verdicts'][1]['access'] == 'Granted';
     }
     return false;
 }